strtof Function

Function:

Converts string representation of a real value into a real value.

Syntax:

strtof(byref str as string) as real

See Also:

ftostr, str, val


Part

Description

str

String to convert.


Details

You must keep in mind that floating-point calculations are inherently imprecise. Not every value can be converted into its exact floating-point representation. Also, strtof can be invoked implicitly. The example below illustrates this.


Examples

Tibbo BASIC
dim r1 as real
dim s as string
 
s="456.125"
r1=strtof(s) 'r1 will be equal to 456.125. This conversion will be done without errors.
s="123.200"
r1=strtof(s) '123.200 will be converted with errors. Actual result will be 123.25.
r1=s 'implicit invocation. Same result as for the line above.

strtof Function

Details

Examples