Catastrophic Cancellation (2020)
twitter.com
twitter.com
The general point is that "cancellation error" happens more than just in floating-point operations, but also in "classic scientific sig-fig error analysis".
---------
The tweet should either be dumbed down to discuss cancellation error in floating-point arithmetic, or elevated up and assume people know about sig-fig analysis. It sits at a weird point in the "assumed knowledge" curve.
---------
For people unfamiliar with cancellation error, try the two following statements in Python3 (which defaults to double-precision... aka 53-bits of mantissa).
poor_ordering = 9007199254740992.0 + 1.0 + 1.0 + 1.0 + 1.0 - 9007199254740992.0
good_ordering = 9007199254740992.0 - 9007199254740992.0 + 1.0 + 1.0 + 1.0 + 1.0
What are the values of "poor_ordering" vs "good_ordering" ?? What does this tell us about double-precision?9007199254740992.0 == 2^53. So it is impossible for a double-precision number to accurately represent +/- 1.0 at 2^53. (Note that +/- 2.0 will work out just fine).
Play around with 9007199254740992.0 +/- 1.0, or 2.0, and other values for about 15 minutes, and you'll probably learn everything you need to know about cancellation error from that playtime alone.
Double-precision numbers are composed of 52-explicit bits + 1 implicit bit + 1 sign bit + 11-bit exponent bits (yes, 65-bits total. The implicit bit "doesn't count", but makes 0.0 and subnormal numbers harder to deal with)
That example only shows that relative errors can explode even when doing simple calculations.
Another thing is that, in computers, calculations often are imprecise.
Because of catastrophic cancellation and similar issues, that means that the computer result of a calculation can be quite different from the mathematical result.
To make matters worse, in real life, we often don’t know the exact values of things we measure, so even if our calculations are mathematically perfect, the outcome of a calculation by computer can be quite different from the real result.
So, if you do a computer calculation, say to compute how strong a bridge has to be, you really, really need to know now close the computed value, at worst, is to the mathematically exact result.
That’s what numerical analysis is about. For a given calculation, it might say such things as
“if the input is between 100 and 200, to get a result with n decimal digits of precision, you’ll have to compute all intermediate results with 4 × n digits.”
or
”but if you rearrange the computation like this, you only need to use 2 × n digits for n digits of precision in your result”
Rearranging helps when you can only store intermediate results with finite precision, but you can compute them to arbitrary precision.
It threw me off enough that I didn't get the original point of it re: floating point numbers until your comment - in our floating point formats, the imprecision is often an accidental effect of the limits of the format, vs a true unknown, and then magnifying the relative size of that arbitrary limitation is a problem.
For geology, it's often easier to put things in the right order due to rock layers rather than to figure how long ago they were from present.
In this case, obviously, the Earth is older than the oceans, even if the estimated ages were even rougher and the error bars implied they could be in the opposite order.
For history, you may be able to figure out the relative order of events without knowing what year they were on our calendar.
That coverage can come from testing, proving or careful reading etc.
It tends to pollute the replies more often than not, with more people invoking it than actually replying.
Edit: it’s also great for preserving content which may be deleted.
It gives a disproportionate meaning to 0 without real physical consideration, eg:
- 0.1⁰C ± 0.1 (wow 100% relative error) - 273.25K ± 0.1 (meh 0.04% relative error)
Beside that if there are uncertainties involved, one should do proper propagation of uncertainty anyways. [1]
[0] https://en.wikipedia.org/wiki/Level_of_measurement
[1] https://en.wikipedia.org/wiki/Propagation_of_uncertainty
What would make a difference is to change to https://en.wikipedia.org/wiki/Thermodynamic_beta
(Essentially the same difference as miles per gallons vs litres per 100 km.)