[Cfp-interest 1293] Re: Next representable for a double-double

Stephen Canon scanon at apple.com
Fri Apr 26 05:23:22 PDT 2019


This isn’t quite right; it skips a value when the sign of lo flips.

A simple example is ld = 1 + e/2 Your algorithm gives the next value as 1 + u(e/2), but the value halfway in between is also representable in the form (1+e) - d(e/2), where “e” is 0x1.0p-52, "u( )" and "d( )" are nextup and nextdown, respectively.

– Steve

> On Apr 25, 2019, at 11:44 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> How to find next representable number for long double being a
> double-double.
> 
> long double ld = some value;
> double dhi, dlo;
> 
> dhi = ld;       /* get high word */
> dlo = ld - dhi; /* get low word */
> dlo = nextafter(dlo,INFINITY); /* next representable */
> ld = dhi + dlo; /* next representable after ld */
> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com      Testing, numerics, programming
> +1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
> Sample C99+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest




More information about the Cfp-interest mailing list