Action
Instruct the compiler to use an alternative conversion routine for representation of a single.
Syntax
CONFIG SINGLE = SCIENTIFIC , DIGITS = value
Remarks
Digits |
A numeric constant with a value between 0 and 7. A value of 0 will result in no trailing zero's. A value between 1-7 can be used to specify the number of digits behind the comma. |
When a conversion is performed from numeric single variable, to a string, for example when you PRINT a single, or when you use the STR() function to convert a single into a string, a special conversion routine is used that will convert into human readable output. You will get an output of digits and a decimal point.
This is well suited for showing the value on an LCD display. But there is a downside also. The routine is limited in the way that it can not shown very big or very small numbers correct.
The CONFIG SINGLE will instruct the compiler to use a special version of the conversion routine. This version will use scientific notation such as : 12e3.
You can specify how many digits you want to be included after the decimal point.
See also
NONE
ASM
Uses single.lbx library
Example
'----------------------------------------------------------------
' (c) 1995-2005, MCS
' single_scientific.bas
' demonstation of scientific , single output
'----------------------------------------------------------------
$regfile = "m88def.dat"
$crystal = 8000000
$baud = 19200
'you can view the difference by compiling and simulating this sample with the
'line below remarked and active
Config Single = Scientific , Digits = 7
Dim S As Single
S = 1
Do
S = S / 10
Print S
Loop