Floating-point literals are decimal numbers. They can be expressed in either standard or scientific notation.
Standard notation consists of a whole number followed by a decimal point and a fractional component. Examples of floating-point literals expressed in standard notation are 3.145, 2.0, etc.
Scientific notation consists of standard-notation, i.e., a floating-point number, and a suffix that specifies a power of 10 by which the number is to be multiplied. The exponent portion is either represented by an E or e, followed by an integer, which can be either positive or negative. Examples of floating-point literals expressed in scientific notation are 6.02E23, 1e-6, etc.
Floating-point literals are of type double, by default. A floating-point literal, is followed by an F or f, to indicate that the literal is of type float in a program, e.g., 6.023E2F, 23.34f, etc.
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.