Debian Codegraph @

upstream/debian-unstable/man3/signbit.3

raw
1 '\" t
2 .\" Copyright 2002, Walter Harms <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH signbit 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 signbit \- test sign of a real floating-point number
10 .SH LIBRARY
11 Math library
12 .RI ( libm ,\~ \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B "#include <math.h>"
16 .P
17 .BI "int signbit(" x ");"
18 .fi
19 .P
20 .RS -4
21 Feature Test Macro Requirements for glibc (see
22 .BR feature_test_macros (7)):
23 .RE
24 .P
25 .BR signbit ():
26 .nf
27 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
28 .fi
29 .SH DESCRIPTION
30 .BR signbit ()
31 is a generic macro which can work on all real floating-point types.
32 It returns a nonzero value if the value of
33 .I x
34 has its sign bit set.
35 .P
36 This is not the same as
37 .IR "x < 0.0" ,
38 because IEEE 754 floating point allows zero to be signed.
39 The comparison
40 .I \-0.0\~<\~0.0
41 is false, but
42 .I signbit(\-0.0)
43 will return a nonzero value.
44 .P
45 NaNs and infinities have a sign bit.
46 .SH RETURN VALUE
47 The
48 .BR signbit ()
49 macro returns nonzero if the sign of
50 .I x
51 is negative;
52 otherwise,
53 it returns zero.
54 .SH ERRORS
55 No errors occur.
56 .SH ATTRIBUTES
57 For an explanation of the terms used in this section, see
58 .BR attributes (7).
59 .TS
60 allbox;
61 lbx lb lb
62 l l l.
63 Interface Attribute Value
64 T{
65 .na
66 .nh
67 .BR signbit ()
68 T} Thread safety MT-Safe
69 .TE
70 .SH STANDARDS
71 C11, POSIX.1-2008.
72 .SH HISTORY
73 POSIX.1-2001, C99.
74 .P
75 This function is defined in IEC 559 (and the appendix with
76 recommended functions in IEEE 754/IEEE 854).
77 .SH SEE ALSO
78 .BR copysign (3)