Note | ||
---|---|---|
| ||
This rule may be deprecated and replaced by a similar guideline. 06/28/2014 -- Version 1.0 |
The Java language provides two primitive floating-point types, float
and double
, which are associated with the single-precision 32-bit and double-precision 64-bit format values and operations specified by IEEE 754 [IEEE 754]. Each of the floating-point types has a fixed, limited number of mantissa bits. Consequently, it is impossible to precisely represent any irrational number (for example, pi). Further, because these types use a binary mantissa, they cannot precisely represent many finite decimal numbers, such as 0.1, because these numbers have repeating binary representations.
...
FLP02-C. Avoid using floating-point numbers when precise computation is needed | |
FLP02-CPP. Avoid using floating point numbers when precise computation is needed | |
Floating-Point Arithmetic [PLF] |
...
Item 48. Avoid | |
Puzzle 2. Time for a change | |
| |
[IEEE 754] |
|
[JLS 2005] |
...
Rule 03. : Numeric Types and Operations (NUM) NUM05-J. Do not use denormalized numbers