[cfp-interest 3582] Re: nextafterd32() issue

Jim Thomas jaswthomas at sbcglobal.net
Mon Sep 1 15:20:51 PDT 2025



> On Aug 31, 2025, at 4:22 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> Consider  nextafterd32( 0.e-5DF, 0.e+3DF )
> 
> I see two requirements in C23 about this:
> 
> Table 5.2 Preferred quantum exponents
> nextafter:  least possible
> 
> 5.12.11.3 

7.12.12.3

> The nextafter functions
> The nextafter functions return y if x equals y.

This needs to be interpreted as meaning: they return the numerical value of y, not necessarily with the quantum exponent of y. The preferred quantum exponent is specified in Table 5.2.

> 
> There could be three possible return values:
> 0.e+3DF         return y (unchanged)
> 0.e-5DF         return minimum quantum exponent of inputs
> 0.e-101DF       return least possible quantum exponent of y value

Per Table 5.2, the return value has the least possible quantum exponent for the value.

> 
> 
> The issue exists for non-zero values:
> nextafterd32( 10000.e-2DF, 1.e+2DF )
> 
> There could be three possible return values:
> 1.e+2DF         return y (unchanged)
> 10000.e-2DF     return minimum quantum exponent of inputs
> 1000000.e-4DF   return least possible quantum exponent of y value
> 

As above.

- Jim Thomas

> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com      Testing, numerics, programming
> +1 (702) 608-6093      Vice-chair of INCITS/C (ANSI "C")
> Sample C17+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