Open pnathan opened 9 years ago
Floats should be implemented as IEEE 754 binary64 values.
A float consists of an integer part (which follows the same rules as decimal integer values) followed by a fractional part and/or an exponent part. If both a fractional part and exponent part are present, the fractional part must precede the exponent part.
flt1 = +1.0 flt2 = 3.1415 flt3 = -0.01
flt4 = 5e+22 flt5 = 1e06 flt6 = -2E-2
flt7 = 6.626e-34 A fractional part is a decimal point followed by one or more digits.
An exponent part is an E (upper or lower case) followed by an integer part (which follows the same rules as decimal integer values but may include leading zeros).
The decimal point, if used, must be surrounded by at least one digit on each side.
invalid_float_1 = .7 invalid_float_2 = 7. invalid_float_3 = 3.e+20 Similar to integers, you may use underscores to enhance readability. Each underscore must be surrounded by at least one digit.
flt8 = 224_617.445_991_228 Float values -0.0 and +0.0 are valid and should map according to IEEE 754.
Special float values can also be expressed. They are always lowercase.
sf1 = inf # positive infinity sf2 = +inf # positive infinity sf3 = -inf # negative infinity
sf4 = nan # actual sNaN/qNaN encoding is implementation-specific
sf5 = +nan # same as nan
sf6 = -nan # valid, actual encoding is implementation-specific