Re: Generic get_d_2exp failures

2017-10-28 Thread Niels Möller
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

Re: Generic get_d_2exp failures

2017-10-28 Thread paul zimmermann
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

Re: Generic get_d_2exp failures

2017-10-28 Thread Marc Glisse
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 /=

Re: Generic get_d_2exp failures

2017-10-28 Thread Niels Möller
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