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 _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE ||
19 _POSIX_C_SOURCE >= 200112L;
20 or cc -std=c99
21
23 signbit() is a generic macro which can work on all real floating-point
24 types. It returns a nonzero value if the value of x has its sign bit
25 set.
26
27 This is not the same as x < 0.0, because IEEE 754 floating point allows
28 zero to be signed. The comparison -0.0 < 0.0 is false, but sign‐
29 bit(-0.0) will return a nonzero value.
30
31 NaNs and infinities have a sign bit.
32
34 The signbit() macro returns nonzero if the sign of x is negative; oth‐
35 erwise it returns zero.
36
38 No errors occur.
39
41 Multithreading (see pthreads(7))
42 The signbit() macro is thread-safe.
43
45 C99, POSIX.1-2001. This function is defined in IEC 559 (and the appen‐
46 dix with recommended functions in IEEE 754/IEEE 854).
47
49 copysign(3)
50
52 This page is part of release 3.53 of the Linux man-pages project. A
53 description of the project, and information about reporting bugs, can
54 be found at http://www.kernel.org/doc/man-pages/.
55
56
57
58GNU 2013-07-04 SIGNBIT(3)