News for hackers. Stuff that matters.
Re:The Fundamental Axiom of Floating Point Arithmetic by CharlesHorsey on Wednesday August 05, 2020 @03:06AM (#24058044)
"It fails for x-y when x and y are close"

I don't think that's quite right. Each individual operation is accurate within epsilon, the trouble with cancellation is that the error from operations prior to the subtraction is much larger than the result of the subtraction.

Example, if I do 1 + 2^30 - 2^30 in single precision I get zero. But each individual operation is correct. 1 + 2^30 = 2^30, so the error is 1 < 2^30 * epsilon. Then 2^30 - 2^30 = 0, which is exactly correct.

Re:The Fundamental Axiom of Floating Point Arithmetic by fanf2 on Wednesday August 05, 2020 @03:14AM (#24058079)
Yes. The big errors appear when you remember x is actually (1+ε)x, as explained towards the end of the article. If you assume the inputs are exact then you get an accurate result, but if you are doing error analysis that does not help you.
Re:The Fundamental Axiom of Floating Point Arithmetic by the_svd_doctor on Wednesday August 05, 2020 @11:25AM (#24061854)
This is the right answer. Substraction is accurate, as much as it can be given the its inputs. It’s everything (combined) leading up to it that isn’t.

Every year I struggle to teach this simple concept in class :-) :-(

Re:The Fundamental Axiom of Floating Point Arithmetic by hpcjoe on Wednesday August 05, 2020 @10:59AM (#24061529)
This is due to the non-associative nature of FP. (a+b) + c != a + (b+c).

I disagree that the "axiom" as stated is fundamental. My main argument with it is that I don't see an easy way to go from the axiom to usable theorems about FP.

Happy to be wrong on this, but I am missing this at this time.

Re:The Fundamental Axiom of Floating Point Arithmetic by augustt on Wednesday August 05, 2020 @03:37PM (#24064680)
I'd say not only is fundamental, it's pretty much the only tool you have to start the analysis of an FP algorithm. If you want to analyze a naive sum algorithm for instance you do that by recursively applying the a ⊕ b = (a + b)(1 + ε) rule and figure out how the epsilons bubble up - the result being that the error is linear with the sum length.
Re:The Fundamental Axiom of Floating Point Arithmetic by augustt on Wednesday August 05, 2020 @03:20AM (#24058114)
Yep the term for this is catastrophic cancellation, which doesn’t invalidate the axiom.