]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/signbit.3
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man3 / signbit.3
1 '\" t
2 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
5 .\"
6 .\" SPDX-License-Identifier: GPL-1.0-or-later
7 .\"
8 .\" Based on glibc infopages, copyright Free Software Foundation
9 .\"
10 .TH signbit 3 (date) "Linux man-pages (unreleased)"
11 .SH NAME
12 signbit \- test sign of a real floating-point number
13 .SH LIBRARY
14 Math library
15 .RI ( libm ", " \-lm )
16 .SH SYNOPSIS
17 .nf
18 .B "#include <math.h>"
19 .P
20 .BI "int signbit(" x ");"
21 .fi
22 .P
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
27 .P
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 .P
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 .I \-0.0\~<\~0.0
44 is false, but
45 .I signbit(\-0.0)
46 will return a nonzero value.
47 .P
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 .TS
61 allbox;
62 lbx lb lb
63 l l l.
64 Interface Attribute Value
65 T{
66 .na
67 .nh
68 .BR signbit ()
69 T} Thread safety MT-Safe
70 .TE
71 .SH STANDARDS
72 C11, POSIX.1-2008.
73 .SH HISTORY
74 POSIX.1-2001, C99.
75 .P
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)