G
glen herrmannsfeldt
(snip, I wrote)
In base 2 floating point, either one works. The final divide just
changes the exponent. In any other base, though, the simpler one can
lose precision.
In two digit decimal, (32+34)/2 is 33, but (64+68)/2 is 65.
64+68 is 13e1 and 13e1/2 is 65.
It is used for IBM base 16 floating point and, will be needed
for the now part of the IEEE standard, decimal float.
-- glen
Mathematically, ((r + x/r)/2) and (x/r + (r - x/r)/2) are equivalent. Is
there a numerical reason to prefer one over the other? (Obviously, if
there are no such concerns, one might as well use the simpler one.)
In base 2 floating point, either one works. The final divide just
changes the exponent. In any other base, though, the simpler one can
lose precision.
In two digit decimal, (32+34)/2 is 33, but (64+68)/2 is 65.
64+68 is 13e1 and 13e1/2 is 65.
It is used for IBM base 16 floating point and, will be needed
for the now part of the IEEE standard, decimal float.
-- glen