1signbit(3) Library Functions Manual signbit(3)
2
3
4
6 signbit - test sign of a real floating-point number
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 int signbit(x);
15
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 signbit():
19 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
20
22 signbit() is a generic macro which can work on all real floating-point
23 types. It returns a nonzero value if the value of x has its sign bit
24 set.
25
26 This is not the same as x < 0.0, because IEEE 754 floating point allows
27 zero to be signed. The comparison -0.0 < 0.0 is false, but sign‐
28 bit(-0.0) will return a nonzero value.
29
30 NaNs and infinities have a sign bit.
31
33 The signbit() macro returns nonzero if the sign of x is negative; oth‐
34 erwise it returns zero.
35
37 No errors occur.
38
40 For an explanation of the terms used in this section, see at‐
41 tributes(7).
42
43 ┌────────────────────────────────────────────┬───────────────┬─────────┐
44 │Interface │ Attribute │ Value │
45 ├────────────────────────────────────────────┼───────────────┼─────────┤
46 │signbit() │ Thread safety │ MT-Safe │
47 └────────────────────────────────────────────┴───────────────┴─────────┘
48
50 C11, POSIX.1-2008.
51
53 POSIX.1-2001, C99.
54
55 This function is defined in IEC 559 (and the appendix with recommended
56 functions in IEEE 754/IEEE 854).
57
59 copysign(3)
60
61
62
63Linux man-pages 6.04 2023-03-30 signbit(3)