3 ms·
I've seen this idea of storing the precision mentioned many times on HN, but I must say I don't believe in it outside of some few niches. First reason being th
by im3w1l 8y ago
I've seen this idea of storing the precision mentioned many times on HN, but I must say I don't believe in it outside of some few niches.
First reason being that it's much more complex and it's unclear what the complexity buys us.
Second reason is that it doesn't model how variables co-vary. As a toy example imagine that I have a number x: 5+-1.
Then I let y = x - 1: 4+-1
Finally I let z = 1 / (x - y).
Now, by construction z will be very close to 1. But a system naively tracking uncertainties will be very concerned x - y. If it does a worst case analysis it gets 1+-2. If it does an average case analysis assuming independent gaussian errors it gets 1+-sqrt(2). When we perform the division our uncertainty goes infinite.
- protonfish 8y agoI don't see any reason to claim that explicit-precision floating-point is more complex, just different. Yes, change is uncomfortable and takes effort, but it does necessarily mean the new way is inherently more complicated. I worry about objections based on "that's not what we are taught in school." I think that what we teach can (and should) be improved if need be, and not used as a motivation to deny criticism of established dogma. I am not sure if I fully understand your example, but I don't see any problem with it. Using basic significant figure rules, this is (with an additional step for clarity): x: 5e0 y = x - 1: 4e0 z1 = x - y: 1e0 z = 1/1e0 z2 = 1e0 The answer seems to simply be 1+-1. "Significant Figures" are a simplification of precision where the precision is an integer that represents the total digits of the least precise measurement. A more accurate way is to represent precision as standard deviation, then calculate the precision of the result with basic statistical techniques.
- jcranmer 8y agoI recently saw a presentation that modeled floating point error using Monte Carlo simulation. Any time you introduce uncertainty (such as the sub-ULP rounding error in every operation), you can insert random variation and find which bits end up being stable to find out how good your answer is. While the point was modelling floating point error, it's not hard to extend the idea to modelling the input measurement error in the first place.