man-pages/man3/nextafter.3

55 lines
1.6 KiB
Groff

.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" Based on glibc infopages
.TH NEXTAFTER 3 2002-08-10 "GNU" "Linux Programmer's Manual"
.SH NAME
nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl \-
floating point number manipulation
.SH SYNOPSIS
.B #include <math.h>
.sp
.BI "double nextafter(double " x ", double " y );
.br
.BI "float nextafterf(float " x ", float " y );
.br
.BI "long double nextafterl(long double " x ", long double " y );
.sp
.BI "double nexttoward(double " x ", long double " y );
.br
.BI "float nexttowardf(float " x ", long double " y );
.br
.BI "long double nexttowardl(long double " x ", long double " y );
.sp
Link with \fI-lm\fP.
.SH DESCRIPTION
The
.BR nextafter ()
functions return the next representable neighbor of
\fIx\fP in the direction towards \fIy\fP.
The size of the step
between \fIx\fP and the result depends on the type of the result.
If \fIx\fP = \fIy\fP the function simply returns \fIy\fP.
If either value is
.IR NaN ,
then
.I NaN
is returned.
Otherwise a value corresponding to the value of the
least significant bit in the mantissa is added or subtracted,
depending on the direction.
.PP
The
.BR nexttoward ()
functions do the same as the
.BR nextafter ()
functions, except that they have a long double second argument.
.PP
These functions will signal overflow or underflow if the result
goes outside of the range of normalized numbers.
.SH "CONFORMING TO"
C99.
This function is defined in IEC 559 (and the appendix with
recommended functions in IEEE 754/IEEE 854).
.SH "SEE ALSO"
.BR nearbyint (3)