1SIGNBIT(3) Linux Programmer's Manual SIGNBIT(3)
2
3
4
6 signbit - test sign of a real floating-point number
7
9 #include <math.h>
10
11 int signbit(x);
12
13 Link with -lm.
14
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 signbit():
18 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
19
21 signbit() is a generic macro which can work on all real floating-point
22 types. It returns a nonzero value if the value of x has its sign bit
23 set.
24
25 This is not the same as x < 0.0, because IEEE 754 floating point allows
26 zero to be signed. The comparison -0.0 < 0.0 is false, but sign‐
27 bit(-0.0) will return a nonzero value.
28
29 NaNs and infinities have a sign bit.
30
32 The signbit() macro returns nonzero if the sign of x is negative; oth‐
33 erwise it returns zero.
34
36 No errors occur.
37
39 For an explanation of the terms used in this section, see at‐
40 tributes(7).
41
42 ┌──────────┬───────────────┬─────────┐
43 │Interface │ Attribute │ Value │
44 ├──────────┼───────────────┼─────────┤
45 │signbit() │ Thread safety │ MT-Safe │
46 └──────────┴───────────────┴─────────┘
48 POSIX.1-2001, POSIX.1-2008, C99. This function is defined in IEC 559
49 (and the appendix with recommended functions in IEEE 754/IEEE 854).
50
52 copysign(3)
53
55 This page is part of release 5.10 of the Linux man-pages project. A
56 description of the project, information about reporting bugs, and the
57 latest version of this page, can be found at
58 https://www.kernel.org/doc/man-pages/.
59
60
61
62GNU 2017-09-15 SIGNBIT(3)