]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/signbit.3
Many pages: Fix style issues reported by `make lint-groff`
[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.\"
95fb8859 5.\" SPDX-License-Identifier: GPL-1.0-or-later
ce347053 6.\"
7dcae896 7.\" Based on glibc infopages, copyright Free Software Foundation
ce347053 8.\"
1d767b55 9.TH SIGNBIT 3 2021-03-22 "GNU" "Linux Programmer's Manual"
fea681da 10.SH NAME
1f985ccf 11signbit \- test sign of a real floating-point number
72328dd5
AC
12.SH LIBRARY
13Math library
8fc3b2cf 14.RI ( libm ", " \-lm )
fea681da 15.SH SYNOPSIS
c7db92b9 16.nf
fea681da 17.B "#include <math.h>"
68e4db0a 18.PP
fe93e677 19.BI "int signbit(" x ");"
c7db92b9 20.fi
68e4db0a 21.PP
d39ad78f 22.RS -4
1f985ccf
MK
23Feature Test Macro Requirements for glibc (see
24.BR feature_test_macros (7)):
d39ad78f 25.RE
68e4db0a 26.PP
1f985ccf 27.BR signbit ():
9d2adbae 28.nf
5c10d2c5 29 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae 30.fi
fea681da 31.SH DESCRIPTION
fe93e677
MK
32.BR signbit ()
33is a generic macro which can work on all real floating-point types.
c7094399 34It returns a nonzero value if the value of
fe93e677
MK
35.I x
36has its sign bit set.
fea681da 37.PP
9fb1e24a 38This is not the same as
fe93e677 39.IR "x < 0.0" ,
1f985ccf 40because IEEE 754 floating point allows zero to be signed.
9fb1e24a 41The comparison
1ae6b2c7 42.I \-0.0\~<\~0.0
9fb1e24a 43is false, but
1ae6b2c7 44.I signbit(\-0.0)
c7094399 45will return a nonzero value.
847e0d88 46.PP
1f985ccf
MK
47NaNs and infinities have a sign bit.
48.SH RETURN VALUE
49The
50.BR signbit ()
c7094399 51macro returns nonzero if the sign of
f6ecd76e 52.I x
1f985ccf
MK
53is negative; otherwise it returns zero.
54.SH ERRORS
55No errors occur.
543840ca 56.SH ATTRIBUTES
5f1e440f
PH
57For an explanation of the terms used in this section, see
58.BR attributes (7).
c466875e
MK
59.ad l
60.nh
5f1e440f
PH
61.TS
62allbox;
c466875e 63lbx lb lb
5f1e440f
PH
64l l l.
65Interface Attribute Value
66T{
543840ca 67.BR signbit ()
5f1e440f
PH
68T} Thread safety MT-Safe
69.TE
c466875e
MK
70.hy
71.ad
72.sp 1
47297adb 73.SH CONFORMING TO
267bb6ab 74POSIX.1-2001, POSIX.1-2008, C99.
c13182ef 75This function is defined in IEC 559 (and the appendix with
fea681da 76recommended functions in IEEE 754/IEEE 854).
47297adb 77.SH SEE ALSO
fea681da 78.BR copysign (3)