Marc Glisse writes:
> On Sat, 28 Oct 2017, Niels Möller wrote:
>
>> It would be nice if we could find a portable way to add two floating
>> point values without rounding up. Would something like this work?
>>
>> s = a + b; /* Assume a > b */
>> r = (s - a) - b; /* No
Niels,
> It would be nice if we could find a portable way to add two floating
> point values without rounding up.
see http://perso.univ-perp.fr/langlois/slides/imacs05_sl.pdf,
slide 10, algorithms "Two Sum" and "Fast Two Sum" in the literature.
Paul
On Sat, 28 Oct 2017, Niels Möller wrote:
Marc Glisse writes:
2) The rounding occurs in the addition in
weight = 1/MP_BASE_AS_DOUBLE;
d = up[size - 1];
for (i = size - 2; i >= 0; i--)
{
d += up[i] * weight;
weight /=
Marc Glisse writes:
> 2) The rounding occurs in the addition in
>
> weight = 1/MP_BASE_AS_DOUBLE;
> d = up[size - 1];
> for (i = size - 2; i >= 0; i--)
> {
> d += up[i] * weight;
> weight /= MP_BASE_AS_DOUBLE;
> if