Start Back Next End
  
ZBasic System Library
127
ZBasic Microcontrollers
Fmt
Type
Function returning String
Invocation
Fmt(val, fracDigits)
Parameter
Method
Type
Description
val
ByVal
Single
The value to convert to a string.
fracDigits
ByVal
Byte
The number of digits to produce following the decimal point.
Discussion
This function returns a String that represents the value of the val parameter.   The string will have a
number of digits following the decimal point as specified by the fracDigits parameter.  The maximum
number of digits to the right of the decimal point is 6.  If the fracDigits parameter specifies a larger
number, it will be ignored and 6 will be used.
For very large and very small values, the returned string may be in scientific notation form.  Also, some
special cases are detected resulting in the strings shown in the table below.  See the System Library
function SngClass() for more information about the special values.
Special Value
Result¹
NaN
"*.**".
±Infinity
"&.&&"
Denormalized value
"#.##"
1
The number of special characters following the decimal
point will be the same as the number of fraction digits that
would have been generated had the value been normal.
Compatibility
In BasicX, the maximum number of fraction digits is 3 and the valid range of the value parameter is –
999.0 to +999.0.  If either of those ranges is exceeded, BasicX produces a string containing a single
asterisk.  Moreover, no provision is made for detecting special values such as NaN.
Previous page Top Next page