Floating Point Numbers
A floatingpoint number is a /wiki/cat/number consisting of an optional sign, one or more digits, a decimal point optionally followed by one or more digits, optionally followed by the letter e
or E
, optionally followed by a sign, followed by one or more digits.
A number without a decimal point is an Integer numbers.
[=sign=] digit
[=digit= [ ... ] ] .
[ { digit
[=digit= [ ... ] ] } ] [{=e=  E=} [=sign
] digit
[=digit= [=digit= [ ... ] ] ]

sign
: +
or 
, if the sign is missing, it is presumed to be +
.

digit
: 0
through 9
.

.
: indicates the number is a floating point number rather than an Integer numbers.

e
or E
: indicates the number has an exponent. The case is ignored. There must be at least one digit after the E
or e
, optionally preceded by a sign.
At least one digit must appear before the decimal point. Note that while no digits are required after the decimal point, at least one digit must follow an E
or e
if it is used.
If there is no decimal point and no exponant, then the number will be interpreted as an integer.
The following are all valid floatingpoint numbers:
0.0 +0.0 0. 0.0 0.0e+1 0.0e1 0.e+0 0.0e0 0.0e0 0.0e0 (all are the same 0.0) 0.7 0.3 1.0 1. 1. 1.0 37.16 40.33 +1.5 12.34 3.14159267 1.39e5 1.7E3
The following are all the same:
1000000.0 1.E+7 1e7 1.0e7 10.0e6 0.100E8 10000000.0E1
Gambas provides two different floatingpoint types:
FloatingPoint

Description

Default value

Size in memory

Single

1.7014118E38 .. +1.7014118E+38

0.0

4 bytes

Float

8.98846567431105E307 .. +8.98846567431105E+307

0.0

8 bytes

See also