Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 788 Bytes

ii.5.6-floating-point-numbers.md

File metadata and controls

26 lines (18 loc) · 788 Bytes

II.5.6 Floating-point numbers

There are two different ways to specify a floating-point number:

  1. As a RealNumber.

  2. 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, while float64(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]