Chapter Contents

Previous

Next
nexttoward

nexttoward



Compute the next floating-number in a specific direction

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <math.h>

   double nexttoward(double x, double y);
   float nexttowardf(float x, float y);
   long double nexttowardl(long double x, long double y);


DESCRIPTION

nexttoward returns the next representable value after x in the direction of y. That is, if y > x, then the value returned is the next double greater than x; if y < x, the the value returned is the next double less than x; and if y == x, the value returned is y.

The function name nexttowardf should be used for float arguments, and nexttowardl for long double arguments. Alternately, if the header file tgmath.h is included, nexttoward may be used with any numeric argument type.


RETURN VALUE

nexttoward returns the next value after x. See DESCRIPTION.


RELATED FUNCTIONS

nextafter


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.