Number
A number consists of an optional sign, one or more digits, an optional decimal point followed optionally by one or more digits, optionally followed by the letter e, optionally followed by a sign, followed by one or more digits.
[ sign ] digit [ digit [ ... ]] [ . { digit [ digit [ ... ] ] } ] [ { e | E } [ sign ] digit [ digit [ digit [ ... ] ] ]
- sign : + or -, if the sign is missing, it is presumed to be +.
- digit : 0 through 9.
- . : indicates the number is a Floating Point Numbers number rather than an Integer.
- e or E : indicates the number has an exponent. The case is ignored. There must be at least one digit after the E or e, optionally preceded by a sign.
If a decimal-point is used, at least one digit must precede it. While no digits are required after a decimal point, at least one digit
must follow an
E or
e if it is used.
Specifying an exponent does not necessarily mean the number is a
floating-point.
The following are all valid numbers:
0 -0 +0 (all three are the same integer 0)
0.0 0. -0.e0 -0.0 +0.0 (all are the same float 0.0)
1 +1 -1 7. 1.0 -1.0 -10.0e-1 -0.1e+1 3716 -4033 1.5 -12.34 1. 01.0 3.14159267 1E5 1.7E-3
The following are all the same value, and represent an
Integer:
1000000 1E+7 10E6 10000000E-1
The following are all the same, and represent a
floating-point number:
1000000.0 1.E+7 1.0e7 10.0e6 0.100E8 10000000.0E-1