mirror of https://github.com/mkerrisk/man-pages
68 lines
1.8 KiB
Groff
68 lines
1.8 KiB
Groff
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
|
|
.\" Distributed under GPL
|
|
.\" Based on glibc infopages
|
|
.TH NEXTAFTER 3 2007-07-26 "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.
|
|
.sp
|
|
.in -4n
|
|
Feature Test Macro Requirements for glibc (see
|
|
.BR feature_test_macros (7)):
|
|
.in
|
|
.sp
|
|
.ad l
|
|
All functions shown above:
|
|
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE; or
|
|
.I cc\ -std=c99
|
|
.ad b
|
|
.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
|
|
.I "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)
|