On 2020-Feb-12 15:11:27 -0700, Warner Losh <imp(a)bsdimp.com> wrote:
Most cs types barely know that 2.234 might not be an
exact number when
converted to binary...
My favourite example (based on a real bug that I was involved in
investigating) is: int(0.29 * 100) = 28 (using IEEE doubles). That result
is very counter-intuitive. (Detailed explanation available on request).
In some ways IEEE-754 has made things worse - before that standard, almost
every computer system implemented something different. Floating point was
well known to be "here be dragons" territory and people who ventured there
were either foolhardy or had enough numerical analysis training to be able
to understand (and cope with) what the computer was doing.
IEEE-754 offered a seeming nirvana - where the same inputs would result in
the same outputs (down to the bit) irrespective of what computer you ran
your code on. The underlying problems were still present but, at least in
simple cases, were masked. Why employ an experienced numerical analyst to
develop the code when a high-school student can translate the mathematical
equations into running code in the language-du-jour? (And some languages,
like Java, make a virtue out of hiding all the information needed to
properly handle exceptional conditions).
--
Peter Jeremy