Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
FloatToStr
482
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function FloatToStr(dim input as realdim byref output as
string
[22])
Returns
- 3 if input number is NaN 
- 2 if input number is -INF 
- 1 if input number is +INF 
- 0 if conversion was successful 
Description
Converts a floating point number to a string.
Parameters : 
input:
floating point number to be converted 
output:
destination string 
The output string is left justified and null terminated after the last digit.
Note: Given floating point number will be truncated to 7 most significant digits
before conversion.
Requires
Nothing.
Example
dim ff1, ff2, ff3 as real
txt 
as string[22]
...  
ff1 = -374.2
ff2 = 123.456789
ff3 = 0.000001234
FloatToStr(ff1, txt)  ' txt is "-374.2"
FloatToStr(ff2, txt)  ' txt is "123.4567"
FloatToStr(ff3, txt)  ' txt is "1.234e-6"