Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note
titleDeprecated

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.

...

...

[Bloch 2008]

Item 48. Avoid float and double if exact answers are required

[Bloch 2005]

Puzzle 2. Time for a change

[Goldberg 1991]

 

[IEEE 754]

 

[JLS 2005]

§4.2.3, Floating-Point Types, Formats, and Values

 

...

      Rule 03. : Numeric Types and Operations (NUM)      NUM05-J. Do not use denormalized numbers