logoalt Hacker News

glimshe • today at 12:34 PM • 2 replies • view on HN

The rounding behavior with true decimals is easy to control and understand across number magnitudes and doesn't suffer from platform specific quirks like floats/doubles.

The article's images clearly show the rounding error mess your get without decimals.


Replies

sobriquet9 • today at 1:29 PM

There's still catastrophic cancellation, where subtracting two large numbers that are very close results in an answer with reduced precision.

amelius • today at 12:39 PM

But the rounding errors are way down in the nano-cents. Not worrying about them is cheaper!

➕ show 2 replies