logoalt Hacker News

Maxatarlast Saturday at 7:56 PM2 repliesview on HN

There are pretty trivial ways to use binary floating point values that don't result in 0.1 + 0.2 producing 0.30000...4 and it saddens me when this topic comes up and people go to such extreme lengths to recreate a second hand buggy reimplementation of a subset of floating point numbers to do it.


Replies

woriklast Saturday at 11:01 PM

> There are pretty trivial ways to use binary floating point values that don't result in 0.1 + 0.2 producing 0.30000...4

Not across all architectures and operating systems there are not

Listen to those who have done this. Use integers for finance.

show 1 reply
FabHKlast Sunday at 3:16 PM

What are those pretty trivial ways? And how are they better than storing 10 cents + 20 cents = 30 cents?

show 1 reply