When evaluating with IEEE 754 floating point numbers a and b, what is the worst case error in terms of the magnitude of a and b of the sum (a - b) + b? How close to a can I expect that to be?
Asked
Active
Viewed 241 times
0
-
What do you mean “worst case error in terms of the magnitude of a and b”? Generally, a and b have two magnitudes, so you would to define an order that determines which of (x0, y0) and (x1, y1) is worse, for errors x0 and x1 relative to a and y0 and y1 relative to b. If you just want the worst case for error relative to a, you should edit the question to remove “and b”. – Eric Postpischil Jun 14 '18 at 00:21
-
If 100% is larger than you need, problems like these are sometimes addressed by examining constraints on the values. For example, in your actual problem, perhaps `b` is always smaller than `a`, perhaps much smaller. Then the error would be more limited. – Eric Postpischil Jun 14 '18 at 00:32
-
@EricPostpischil Just so you know, in English, we say "the magnitude" (singular) of a and b because each of "a" and "b" has one magnitude. It is like saying "the magnitude of a, and the magnitude of b". – Neil G Jun 14 '18 at 09:09
-
No, we do not. If a and b do not have the same magnitude, then “the magnitude of a and b” is nonsensical, as would be “the house of John and Ray” when John and Ray have different houses. Regardless of grammar, the problem remains: If a and b do not have the same magnitude, then “the worst case error in terms of the magnitude(s) of a and b” is not defined. – Eric Postpischil Jun 14 '18 at 09:42
-
Searching Google for (in quotes) “the magnitude of a and b” shows 7 results. Searching for “the magnitudes of a and b” shows about 8,690,000 results. – Eric Postpischil Jun 14 '18 at 10:15
-
Searching google doesn't matter. It's called the subject-complement agreement, and apparently this sentence can be cast either way: https://www.quickanddirtytips.com/education/grammar/what-is-subject-complement-agreement – Neil G Jun 14 '18 at 10:17
-
(a) You have not addressed the actual problem that there is no defined order for two values. (b) Searching Google shows the **overwhelmingly** dominant use, a million to one. (c) I did not criticize your grammar in the first place; I merly used my own choice. (d) in “terms of the magnitude of a and b,” “magnitude” is not a subject and the phrase “a and b” is not a complement, although there are some similarities to the issues discussed in the page. (e) The page you cite generally does not recommend using terms that grammatically disagree and does favor matching when suitable. – Eric Postpischil Jun 14 '18 at 11:21
-
So, please stop with the grammar and fix the question to define the ordering for cases when the error relative to a and the error relative to b would individually lead to different orders. – Eric Postpischil Jun 14 '18 at 11:23
-
It's the subject of the dependent clause, and that phrase is just like the examples on the page: just like you might say "in the words of the wife of Fred and Bob" *or* "in the words of the wives of Fred and Bob". You can just interpret the question as asking about the maximum error relative to the magnitude of the vector (a, b) if you like. – Neil G Jun 14 '18 at 11:44
1 Answers
4
100%. b
may be so large that a-b
produces -b
, and then (a-b)+b
produces zero.
For example, with IEEE-754 basic 64-bit binary, (1−254)+254 yields 0, with round-to-nearest-ties-to-even. We can also have 100% in the other direction. If a
is 1 and b
is 253+2, then (a-b)+b
produces 2.
Also, if b
is infinity, (a-b)+b
produces a NaN.

Eric Postpischil
- 195,579
- 13
- 168
- 312