Previous Page
Next Page

nexttoward

Obtains the next representable value in the direction of a given long double value

#include <math.h>
double nexttoward ( double x , long double y  );
float nexttowardf ( float x , long double y  );
long double nexttowardl ( long double x , long double y  );

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( )


Previous Page
Next Page