[cfp-interest 3937] Re: FW: [SC22WG14.36462] nexttoward wording does not establish exception to conversion required by nextafter

Damian McGuckin damianm at esi.com.au
Wed May 13 16:12:32 PDT 2026


On Wed, 13 May 2026, RAJAN BHAKTA wrote:

> Example from Hubert of where this can matter if long double precision is
> higher:
> 
> #include <float.h>
> #include <math.h>
> #include <assert.h>
> int main(void) {
>   assert(nexttoward(1., .25L * DBL_EPSILON + 1.) == 1. + DBL_EPSILON);
> }

You cannot afford to convert the 2nd argument for the cases of float or 
double. The above would be just

 	nextup(1.0)

I really think is a problem for Jim or Fred. It is beyond me exactly what 
this the above is trying to achieve.

If it were up to me, I would deprecate nexttoward(). Sorry.

Thanks - Damian


More information about the cfp-interest mailing list