Java: Inaccuracy using double [duplicate]

doubles are not exact.

It is because there are infinite possible real numbers and only finite number of bits to represent these numbers.

have a look at: what every programmer should know about floating point arithmetic

Leave a Comment