There are two different ways to specify a floating-point number:
-
As a RealNumber.
-
By using the keyword float32 or float64, followed by an integer in parentheses, where the integer value is the binary representation of the desired floating-point number. For example,
float32(1)
results in the 4-byte value 1.401298E-45, whilefloat64(1)
results in the 8-byte value 4.94065645841247E-324.
Float32 ::= |
---|
RealNumber |
| float32 '(' Int32 ')' |
Float64 ::= |
---|
RealNumber |
| float64 '(' Int64 ')' |
[Example:
5.5
1.1e10
float64(128) // note: this results in an 8-byte value whose bits are the same
// as those for the integer value 128.
end example]