Floating-Point Constants
Floating-point constants are represented through numbers holding fractional elements like in 549.4545. Floating-point constants are also sometimes known as real number constants.
Example:
0.00098
3210.67
-56.890
+345.9
A real number might also be expressed in the exponential notation. Example for the value 2345.78 might be written as 23.4578e2 in exponential notation. An e2 means multiply by 100. The number 3e-2 would mean 3*1/100.
A few of the valid floating - point constants are: -
0. (digit after the decimal point can be omitted)
.00045 (digit before the decimal point can be omitted)
7.31245e +3 (the notation e3 can also be written as e + 3)
2E-8 (e or E is allowed)
A few of the invalid floating - point constants are: -
12 (decimal point or an exponent must be present)
1,067.89 (comma is not allowed)
3.89e+1.5 (exponent must be an integer)
5E 12 (no embedded spaces are allowed)
Exponential notation is useful for representing numbers which are very large or very small in magnitude. Example for, 45000000000 can be written as 45e9. As same, - 0.000000454 is equal to -4.54e-7.