Numerics
Numeric literals come in the form of a scalar, integer, decimal, or scientific notation (exponential).
A more specific form is:
[+-]iDigits.fDigits [EXP[+-] eDigits]
iDigits, fDigits and eDigits are numeral(s) from 0 to 9, inclusive. Either iDigits or fDigits must exist. If fDigits are specified, the decimal point is required. If no sign is specified for iDigits or eDigits, they are assumed to be positive. Bracketed items are optional.
If iDigits begins with one or more zeros, this is a valid literal, but the zeros are ultimately ignored. EXP can be any of the following characters: dDeE. If EXP is included, eDigits must also be included.
Examples of valid decimal numeric literals include:
- 3
- 3.
- .3
- 3.3
- 33
- 3E3
- 3.3e3
- -3
- 3.3e-3
- 003
- 3d3
- 3D-3
Examples of invalid decimal numeric literals:
- . (either fDigits or iDigits must be specified)
- 3.3.3 (only one decimal point is allowed)
- 3E (if EXP is included, eDigits must also be included)
- E3 (either fDigits or iDigits must be specified)
- 3E3.3 (eDigits must be digits only)
- 4z (iDigits are 0 through 9 inclusive)