This math scares me

Tim Peters tim.one at home.com
Tue Mar 20 22:01:58 EST 2001


[Tim]
> The original Cray Fortran compiler supported that gimmick "in
> reverse":  a compile switch caused each (binary) fp result to get
> *truncated* to N bits (a [simple] masking operation).  Non-experts
> loved it:  via plotting results versus number of bits, unstable
> algorithms often stuck out like a broken nose.

[Neelakantan Krishnaswami]
> Whoa. What an awesomely elegant hack. That goes straight into the box
> of tricks that will someday make me look extremely smart. Thanks!

Na, thank the departed Seymour Cray for designing floating-point units that
traded away accuracy for speed whenever they clashed.  The *original* use of
this compiler switch was to show people coming from 32-bit machines that
their results were wildly different on the 64-bit Cray boxes not because
Cray's arithmetic sucked, but because they had always been getting nonsense
results (when the compiler switch was set to truncate back to the precision
of the box they were coming from, and they got the results they were used to,
and saw that the results bounced around depending on # of bits but eventually
settled down as the # of bits increased beyond what they had before, it was
powerful evidence of numerical instability in their algorithms).

can't-argue-with-bits-the-bits-are-always-right-ly y'rs  - tim





More information about the Python-list mailing list