]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/signbit.3
signbit.3: ffix
[thirdparty/man-pages.git] / man3 / signbit.3
CommitLineData
fea681da 1.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
1f985ccf
MK
2.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
2297bf0e 4.\"
38f20bb9 5.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
fea681da 6.\" Distributed under GPL
38f20bb9 7.\" %%%LICENSE_END
ce347053 8.\"
7dcae896 9.\" Based on glibc infopages, copyright Free Software Foundation
ce347053 10.\"
4b8c67d9 11.TH SIGNBIT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
fea681da 12.SH NAME
1f985ccf 13signbit \- test sign of a real floating-point number
fea681da
MK
14.SH SYNOPSIS
15.B "#include <math.h>"
68e4db0a 16.PP
fe93e677 17.BI "int signbit(" x ");"
68e4db0a 18.PP
1f985ccf 19Link with \fI\-lm\fP.
68e4db0a 20.PP
1f985ccf
MK
21.in -4n
22Feature Test Macro Requirements for glibc (see
23.BR feature_test_macros (7)):
24.in
68e4db0a 25.PP
1f985ccf
MK
26.ad l
27.BR signbit ():
f1f0e4ed 28.RS 4
e464f054 29_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
f1f0e4ed
MK
30.RE
31.ad
fea681da 32.SH DESCRIPTION
fe93e677
MK
33.BR signbit ()
34is a generic macro which can work on all real floating-point types.
c7094399 35It returns a nonzero value if the value of
fe93e677
MK
36.I x
37has its sign bit set.
fea681da 38.PP
9fb1e24a 39This is not the same as
fe93e677 40.IR "x < 0.0" ,
1f985ccf 41because IEEE 754 floating point allows zero to be signed.
9fb1e24a 42The comparison
dbe84068 43.IR "\-0.0 < 0.0"
9fb1e24a 44is false, but
fe93e677 45.IR "signbit(\-0.0)"
c7094399 46will return a nonzero value.
847e0d88 47.PP
1f985ccf
MK
48NaNs and infinities have a sign bit.
49.SH RETURN VALUE
50The
51.BR signbit ()
c7094399 52macro returns nonzero if the sign of
f6ecd76e 53.I x
1f985ccf
MK
54is negative; otherwise it returns zero.
55.SH ERRORS
56No errors occur.
543840ca 57.SH ATTRIBUTES
5f1e440f
PH
58For an explanation of the terms used in this section, see
59.BR attributes (7).
60.TS
61allbox;
62lb lb lb
63l l l.
64Interface Attribute Value
65T{
543840ca 66.BR signbit ()
5f1e440f
PH
67T} Thread safety MT-Safe
68.TE
47297adb 69.SH CONFORMING TO
267bb6ab 70POSIX.1-2001, POSIX.1-2008, C99.
c13182ef 71This function is defined in IEC 559 (and the appendix with
fea681da 72recommended functions in IEEE 754/IEEE 854).
47297adb 73.SH SEE ALSO
fea681da 74.BR copysign (3)