Floating-point numbers are known as real numbers.
They are used when evaluating expressions that require fractional precision.
For example, calculations such as square root, or transcendentals such as sine and cosine.
Java implements the standard (IEEE-754) set of floating-point types and operators.
There are two kinds of floating-point types:
Name | Width in Bits | Approximate Range |
---|---|---|
double | 64 | 4.9e-324 to 1.8e+308 |
float | 32 | 1.4e-045 to 3.4e+038 |