Name

nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl
- floating point number manipulation

Library

libm.lib

Synopsis

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

Detailed description

These functions return the next machine representable number from x in direction y.

Examples

#include <math.h>
int main( )
{
   double inp1 = 1.3;
   double inp2 = 2;
   double y;
   y = nextafter( inp1, inp2 );
   printf( "nextafter(%f , %f) = %f\n", inp1,  inp2,  y );
   y = nextafterf( inp1, inp2 );
   printf( "nextafterf(%f , %f) = %f\n", inp1, inp2, y );
   y = nextafterl( inp1, inp2 );
   printf( "nextafterl(%f , %f) = %f\n\n", inp1, inp2, y );
   inp1 = 9;
   inp2 = 9;
   y = nexttoward( inp1, inp2 );
   printf( "nexttoward(%f , %f) = %f\n", inp1,  inp2,  y );
   y = nexttowardf( inp1, inp2 );
   printf( "nexttowardf(%f , %f) = %f\n", inp1, inp2, y );
   y = nexttowardl( inp1, inp2 );
   printf( "nexttowardl(%f , %f) = %f\n", inp1, inp2, y );
}

         

Output

nextafter  ( 1.3, 2.0 ) = 1.3
nextafterf ( 1.3, 2.0 ) = 1.3
nextafterl ( 1.3, 2.0 ) = 1.3
nexttoward  ( 9, 9 ) = 9
nexttowardf ( 9, 9 ) = 9
nexttowardl ( 9, 9 ) = 9

         


See also

ieee, math

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top