A double does not have a decimal point. It has a mantissa, which always has a single 1 before the radix point, and an exponent, and a sign. You can Google IEEE754 for more details. So "number of places beyond the decimal point" is meaningless. The only floating-point number which actually has a decimal point is BigDecimal. But don't try converting a double to a BigDecimal, otherwise you will get a display with dozens of digits after the decimal point. I believe there are methods in BigDecimal which give you the number of places directly.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41631

31

posted

0

I earlier wrote:. . . mantissa . . . always has a single 1 before the radix point, . . .

. . . except for values with an absolute value < this, or ±0, or ∞ or "NaN". The 1 in "normal" values is implicit; it isn't actually stored in memory.