C examples for math.h:nextafter
function
<cmath> <ctgmath> <math.h>
Returns the next representable value after x in the direction of y.
long double nextafterl (long double x, long double y); long double nextafter (long double x, long double y ); double nextafter (double x , double y); float nextafterf (float x , float y); float nextafter (float x , float y ); double nextafter (Type1 x , Type2 y);
Parameter | Description |
---|---|
x | Base value. |
y | Value toward which the return value is approximated. |
If both parameters compare equal, the function returns y.
The next representable value after x in the direction of y.
#include <stdio.h> #include <math.h> int main ()//from www . j a va2s. c o m { printf ("first representable value greater than zero: %e\n", nextafter(0.0,1.0)); printf ("first representable value less than zero: %e\n", nextafter(0.0,-1.0)); printf ("%e\n", nextafter(10.0,-1.0)); return 0; }