Name
nexttoward
Synopsis
Obtains the next representable value in the direction of a
given long double
value
#include <math.h> doublenexttoward
( doublex
, long doubley
); floatnexttowardf
( floatx
, long doubley
); long doublenexttowardl
( long doublex
, long doubley
);
The nexttoward()
functions
are similar to nextafter()
,
except that the second parameter in all three variants has the type
long double
.
Example
float x =nexttowardf
( 0.0F, -1E-100L );
printf("The greatest negative floating-point number \n"
"(i.e., the closest to zero) with type float: %E\n", x);
This code produces output like the following:
The greatest negative floating-point number (i.e., the closest to zero) with type float: -1.401298E-45
See Also
nextafter()
, nearbyint()
, rint()
, lrint()
, llrint()
, round()
, lround()
, llround()
, ceil()
, floor()
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.