“Double-double” is a representation of numbers as the sum of two double-precision numbers without overlap in the significands. Thi
The article referred to by njuffa offers the function below, with very similar notations to those of my question, except that what is denoted fl (a+b)
there is simply denoted a+b
in my question:
Two−Sum−toward−zero2 (a, b)
if (|a| < |b|)
swap (a , b)
s = fl (a + b)
d = fl (s − a)
e = fl (b − d)
if(|2 ∗ b|<|d|)
s = a, e = b
return (s, e)
This is a very neat fix for this particular elementary computation when in round-toward-zero mode. It makes one hope that something would be possible for implementing a correctly rounded elementary function, at the very least by testing the rounding mode early and picking separate algorithms, or perhaps by writing very careful code that works for all rounding modes.