Real constants can either be decimal or hexadecimal numbers. They may have an optional leading plus or minus sign. The components of a real constant are the integer part, a mantissa, and an exponent used to represent scientific notation.
['+' | '-' ] Integer ['.' [Mantissa [Exponent]]] ['+' | '-' ] [Integer] '.' Mantissa [Exponent]
The integer part and the mantissa consist of decimal digits and underscores. The integer part cannot have a leading underscore. All numeric constants cannot end with an underscore.
A decimal exponent begins with the letter 'E' or 'e' followed by an optional sign and a series of digits and underscores. The exponent multiplies the value by 10 to the power of the exponent.
Decimal.Real := ['+' | '-'] (Decimal.Part ['.' Real.Part]) | ('.' Real.Part) Decimal.Part := Digit [( Digit | '_') Digit Real.Part := Decimal.Part [{'E' | 'e'} ['+' | '-'] Decimal.Part] Digit := '0' to '9'
Real hexadecimal constants are used to generate a precise binary real value. The integer part and the mantissa consist of hexadecimal digits and underscores. The integer part cannot have a leading underscore and again, all numeric constants cannot end with an underscore.
A hexadecimal exponent begins with the letter 'E' or 'e' followed by an optional sign and a series of digits and underscores. The exponent multiplies the value by 2 to the power of the exponent.
Hex.Real := ['+' | '-'] '#' { (Hex.Number ['.' Hex.Exponent]) | ('.' Hex.Exponent) } Hex.Exponent := Hex.Number [{'P' | 'p'} ['+' | '-'] Hex.Number] Hex.Number := Hex.Digit [( Hex.Digit | '_') Hex.Digit Hex.Digit := '0' to '9' | 'A' to 'F' | 'a' to 'f'