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