Pref::floatFormat --
representation of floating point numbers
IntroductionPref::floatFormat controls the representation of
floating point numbers.
Call(s)Pref::floatFormat( <modus>)
Parametersmodus |
- | the kind of representation as character
"e", "f", "g" or
"h", or NIL |
Returnsthe previously defined representation
Related
FunctionsDIGITS, Pref::trailingZeroes,
print
DetailsPref::floatFormat can be one of
"e", "f", "g" and
"h". These are the standard C-command
printf switches."e" and "f", only numbers
less than 2^-32 will be displayed with exponential
representation"g" (see examples).Pref::floatFormat without arguments returns
the current value. The argument NIL resets the default
value, which is "g".
Example
1The default display:
>> Pref::floatFormat(NIL): 12345.67890, 0.00012345
12345.6789, 0.00012345
The exponential representation:
>> Pref::floatFormat("e"):
12345.67890, 0.00012345
1.23456789e4, 1.2345e-4
The mixed representation:
>> Pref::floatFormat("g"):
12345.67890, 0.00000000012345
12345.6789, 0.00000000012345
Hexadecimal display:
>> Pref::floatFormat("h"):
12345.67890, 0.00012345
0x0.CE6B7318FC50481*2^(0x00000E),
0x0.81725B672EE3425A*2^(-0x00000C)
"h" can be used instead of
"x" to switch to hexadecimal representation.