nextafter


nextafter

Obtains the next representable value

 #include <math.h> double nextafter ( double x , double y  ); float nextafterf ( float x , float y  ); long double nextafterl ( long double x , long double y  ); 

The nextafter( ) function returns the next value to the first argument x, removed from it in the direction toward the value of y, that is representable in the function's type. If the values of the two arguments are equal, nextafter( ) returns the value of the second argument y.

If the argument x has the magnitude of the largest finite value that can be represented in the function's type, and the result is not a finite, representable value, then a range error may occur.

Example

 double x = nextafter( 0.0, 1.0 ); printf("The smallest positive number "        "with the type double: %E\n", x); 

This code produces output like the following:

 The smallest positive number with the type double: 4.940656E-324 

See Also

nexttoward( ), nearbyint( ), rint( ), lrint( ), llrint( ), round( ), lround( ), llround( ), ceil( ), floor( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net