nextup, nextupf, nextupl, nextdown, nextdownf, nextdownl - return next floating-point number toward
Contents
Attributes
For an explanation of the terms used in this section, see attributes(7).
┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
│ Interface │ Attribute │ Value │
├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
│ nextup(), nextupf(), nextupl(), nextdown(), nextdownf(), nextdownl() │ Thread safety │ MT-Safe │
└─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘
Description
The nextup(), nextupf(), and nextupl() functions return the next representable floating-point number
greater than x.
If x is the smallest representable negative number in the corresponding type, these functions return -0.
If x is 0, the returned value is the smallest representable positive number of the corresponding type.
If x is positive infinity, the returned value is positive infinity. If x is negative infinity, the
returned value is the largest representable finite negative number of the corresponding type.
If x is Nan, the returned value is NaN.
The value returned by nextdown(x) is -nextup(-x), and similarly for the other types.
History
glibc 2.24.
Library
Math library (libm, -lm)
Name
nextup, nextupf, nextupl, nextdown, nextdownf, nextdownl - return next floating-point number toward
positive/negative infinity
Return Value
See DESCRIPTION.
See Also
nearbyint(3), nextafter(3) Linux man-pages 6.9.1 2024-05-02 nextup(3)
Standards
These functions are described in IEEEStd754-2008-StandardforFloating-PointArithmetic and ISO/IECTS18661.
Synopsis
#define_GNU_SOURCE /* See feature_test_macros(7) */ #include<math.h>doublenextup(doublex);floatnextupf(floatx);longdoublenextupl(longdoublex);doublenextdown(doublex);floatnextdownf(floatx);longdoublenextdownl(longdoublex);
