1SIGNBIT(3)                 Linux Programmer's Manual                SIGNBIT(3)
2
3
4

NAME

6       signbit - test sign of a real floating-point number
7

SYNOPSIS

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(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99
18

DESCRIPTION

20       signbit()  is a generic macro which can work on all real floating-point
21       types.  It returns a non-zero value if the value of x has its sign  bit
22       set.
23
24       This is not the same as x < 0.0, because IEEE 754 floating point allows
25       zero to be signed.  The comparison -0.0  <  0.0  is  false,  but  sign‐
26       bit(-0.0) will return a non-zero value.
27
28       NaNs and infinities have a sign bit.
29

RETURN VALUE

31       The signbit() macro returns non-zero if the sign of x is negative; oth‐
32       erwise it returns zero.
33

ERRORS

35       No errors occur.
36

CONFORMING TO

38       C99, POSIX.1-2001.  This function is defined in IEC 559 (and the appen‐
39       dix with recommended functions in IEEE 754/IEEE 854).
40

SEE ALSO

42       copysign(3)
43

COLOPHON

45       This  page  is  part of release 3.22 of the Linux man-pages project.  A
46       description of the project, and information about reporting  bugs,  can
47       be found at http://www.kernel.org/doc/man-pages/.
48
49
50
51GNU                               2008-08-05                        SIGNBIT(3)
Impressum