Hacker News new | ask | show | jobs
by ivanbakel 2034 days ago
That's certainly true. The rationals (of which BigDecimal cannot represent the whole space) are a 0-measure part of the reals. I would not claim that BigDecimal is an exact representation, which is a fact that should be clear to anyone that tries to calculate 2 * PI in arbitrary-precision finite decimals. Even not considering irrational numbers, BigDecimal cannot handle 1/3 + 1/3 + 1/3 = 1 correctly.

It might be fair to claim that floats are more inexact - certainly moreso than Rational, but probably moreso than BigDecimal for the numbers that programmers tend to care about.