Hacker News new | ask | show | jobs
by IEEE754 2405 days ago
FWIW, their "basic answer" page is the simplest i've seen that neither lies or omits critical factors in the 0.1 + 0.2 problem. It's probably a good starting point that induces some lingering questions tempting you to find out more.

If you want a thorough understanding you will want to look at representation-error, rounding-error, error-propagation, why they exist and how they interact.

The interplay between those three forms of numerical error in floating point numbers will also allow you to more easily see the world of limitations of fp beyond 0.1 + 0.2 for yourself.

1 comments

I understand the "problem" from the hardware perspective, but I still don't accept their "basic answer" as reasonable.

> It’s not stupid, just different.

Over the past 50 years, my computer has adapted to how humans normally operate in nearly every other way. Why do they continue to use this system which produces results different from what any normal person expects?

> Computers use binary numbers because they’re faster at dealing with those

Computers are faster at dealing with all-caps ASCII, too, but we've accepted here that micro-optimization is less important than doing what people want. Most of the languages I use have even moved past fixnums. Why have we not improved real arithmetic since 1985?

> Over the past 50 years, my computer has adapted to how humans normally operate in nearly every other way. Why do they continue to use this system which produces results different from what any normal person expects?

Lisps and Lisp-derived languages, like Scheme, have had a proper numerical tower, including rationals, for decades now. Using reals is optional, but using rationals and everything else imposes an efficiency cost, so people make their decision. Implementing rationals in hardware would not necessarily make them more efficient; that is, if you think having rational support in hardware would help, you have to make the case. It isn't an automatic win:

https://yosefk.com/blog/its-done-in-hardware-so-its-cheap.ht...

The numerical tower is one of the features of Lisp that the Algol descendants have not yet stolen, and I don’t know why not.

“Efficiency” is tough to believe given all the other inefficient yet nice features that have been universally adopted, like Unicode, variable length lists, bigints, etc. In many dynamic languages, every method call is a hash table lookup, yet we’re expected to believe they don’t use Decimals by default because it would be too slow? In C++ I’d buy that excuse.

> Over the past 50 years, my computer has adapted to how humans normally operate in nearly every other way. Why do they continue to use this system which produces results different from what any normal person expects?

If you look at any low level hardware it's behavior will be alien and unintuitive to most end-users, your computer has not adapted, only it's ability to support sophisticated high level software that abstracts these things away from end users has improved.

FPUs are no different, calculators round output to 10sf, and as a result most users think calculators are perfect, and that's usually fine... it's not fine when you do programming, because eventually you will need to understand the fundamental limitations of the hardware and more generally finite numerical computation regardless of implementation.

> Why have we not improved real arithmetic since 1985?

Because most people actually want either fixed-point or floating-point arithmetic. Especially if you only consider the population who is willing to spend money to get better hardware to support their use cases.

because FLOPS do not grow on trees.