48 lines
1.3 KiB
Text
48 lines
1.3 KiB
Text
> 123.456; # decimal notation
|
|
123.456
|
|
|
|
> 1.23456e2; # scientific notation
|
|
123.456
|
|
|
|
> Float( 23, -2 ); # float constructor notation, by mantissa and exponent
|
|
0.23
|
|
|
|
> Float( .123456, 3 ); # again
|
|
123.456
|
|
|
|
> Float( 1.23456, 2 ); # again
|
|
123.456
|
|
|
|
> Float( 12.3456, 1 ); # again
|
|
123.456
|
|
|
|
> HFloat( 1.23456, 2 ); # hardware float constructor
|
|
123.456000000000
|
|
|
|
> HFloat( 123.456 ); # again
|
|
123.456000000000
|
|
|
|
> 2.3^30; # large floats are printed using scientific notation
|
|
11
|
|
0.7109434879 10
|
|
|
|
> 2/3; # NOT a float!
|
|
2/3
|
|
|
|
> evalf( 2/3 ); # but you can get one
|
|
0.6666666667
|
|
|
|
> 0.0; # zero
|
|
0.
|
|
|
|
> -0.0; # negative zero
|
|
-0.
|
|
|
|
> Float(infinity); # positive infinity
|
|
Float(infinity)
|
|
|
|
> Float(-infinity); # minus infinity
|
|
Float(-infinity)
|
|
|
|
> Float(undefined); # "NaN", not-a-number
|
|
Float(undefined)
|