Submitter:CFP
Submission Date: 2026-08-03
Document: WG14 N3947
Proposal category:Technical
Title: nexttoward and nextafter
Reference Documents:SC22WG14.36462, CFP issue #31
Summary
Herbert Tong raised a question about nexttoward and nextafter. nexttoward refers back to nextafter; however, nextafter does the wrong thing for nexttoward for the arguments.
The call:
nexttoward( 1.0, 1.L+DBL_EPSILON/4.L )
nexttoward( (double)1.0, (double)(1.L+DBL_EPSILON/4.L)
)
nextafter( 1.0, (double)(1.L+DBL_EPSILON/4.L) )
nextafter( 1.0, 1.0 )
Proposal
Change N3886 7.12.12.3 The nextafter functions;
paragraph 2:
The nextafter functions determine the next representable value, in the return type of the function, after x in the direction of y, where x and y are first converted to the return type of the function.
Change N3886 7.12.12.3 The nextafter functions;
paragraph 2 NOTE:
The argument values are converted to the return type of the function, even by a macro implementation of the function.For decimal floating types, Table 5.2 specifies the preferred quantum exponent of the result.