summaryrefslogtreecommitdiff
path: root/man3/nextafter.3
blob: 399ee123a7d13ea107f6a12120148908c06adf3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.\" 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 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)