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():
18           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
19

DESCRIPTION

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

RETURN VALUE

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

ERRORS

36       No errors occur.
37

ATTRIBUTES

39       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
40       tributes(7).
41
42       ┌────────────────────────────────────────────┬───────────────┬─────────┐
43Interface                                   Attribute     Value   
44       ├────────────────────────────────────────────┼───────────────┼─────────┤
45signbit()                                   │ Thread safety │ MT-Safe │
46       └────────────────────────────────────────────┴───────────────┴─────────┘
47

CONFORMING TO

49       POSIX.1-2001,  POSIX.1-2008,  C99.  This function is defined in IEC 559
50       (and the appendix with recommended functions in IEEE 754/IEEE 854).
51

SEE ALSO

53       copysign(3)
54

COLOPHON

56       This page is part of release 5.12 of the Linux  man-pages  project.   A
57       description  of  the project, information about reporting bugs, and the
58       latest    version    of    this    page,    can     be     found     at
59       https://www.kernel.org/doc/man-pages/.
60
61
62
63GNU                               2021-03-22                        SIGNBIT(3)
Impressum