]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) |
1f985ccf MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
2297bf0e | 4 | .\" |
38f20bb9 | 5 | .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) |
fea681da | 6 | .\" Distributed under GPL |
38f20bb9 | 7 | .\" %%%LICENSE_END |
ce347053 | 8 | .\" |
7dcae896 | 9 | .\" Based on glibc infopages, copyright Free Software Foundation |
ce347053 | 10 | .\" |
4b8c67d9 | 11 | .TH SIGNBIT 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da | 12 | .SH NAME |
1f985ccf | 13 | signbit \- test sign of a real floating-point number |
fea681da MK |
14 | .SH SYNOPSIS |
15 | .B "#include <math.h>" | |
68e4db0a | 16 | .PP |
fe93e677 | 17 | .BI "int signbit(" x ");" |
68e4db0a | 18 | .PP |
1f985ccf | 19 | Link with \fI\-lm\fP. |
68e4db0a | 20 | .PP |
1f985ccf MK |
21 | .in -4n |
22 | Feature Test Macro Requirements for glibc (see | |
23 | .BR feature_test_macros (7)): | |
24 | .in | |
68e4db0a | 25 | .PP |
1f985ccf MK |
26 | .ad l |
27 | .BR signbit (): | |
f1f0e4ed | 28 | .RS 4 |
e464f054 | 29 | _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L |
f1f0e4ed MK |
30 | .RE |
31 | .ad | |
fea681da | 32 | .SH DESCRIPTION |
fe93e677 MK |
33 | .BR signbit () |
34 | is a generic macro which can work on all real floating-point types. | |
c7094399 | 35 | It returns a nonzero value if the value of |
fe93e677 MK |
36 | .I x |
37 | has its sign bit set. | |
fea681da | 38 | .PP |
9fb1e24a | 39 | This is not the same as |
fe93e677 | 40 | .IR "x < 0.0" , |
1f985ccf | 41 | because IEEE 754 floating point allows zero to be signed. |
9fb1e24a | 42 | The comparison |
fe93e677 | 43 | .IR "-0.0 < 0.0" |
9fb1e24a | 44 | is false, but |
fe93e677 | 45 | .IR "signbit(\-0.0)" |
c7094399 | 46 | will return a nonzero value. |
847e0d88 | 47 | .PP |
1f985ccf MK |
48 | NaNs and infinities have a sign bit. |
49 | .SH RETURN VALUE | |
50 | The | |
51 | .BR signbit () | |
c7094399 | 52 | macro returns nonzero if the sign of |
f6ecd76e | 53 | .I x |
1f985ccf MK |
54 | is negative; otherwise it returns zero. |
55 | .SH ERRORS | |
56 | No errors occur. | |
543840ca | 57 | .SH ATTRIBUTES |
5f1e440f PH |
58 | For an explanation of the terms used in this section, see |
59 | .BR attributes (7). | |
60 | .TS | |
61 | allbox; | |
62 | lb lb lb | |
63 | l l l. | |
64 | Interface Attribute Value | |
65 | T{ | |
543840ca | 66 | .BR signbit () |
5f1e440f PH |
67 | T} Thread safety MT-Safe |
68 | .TE | |
47297adb | 69 | .SH CONFORMING TO |
267bb6ab | 70 | POSIX.1-2001, POSIX.1-2008, C99. |
c13182ef | 71 | This function is defined in IEC 559 (and the appendix with |
fea681da | 72 | recommended functions in IEEE 754/IEEE 854). |
47297adb | 73 | .SH SEE ALSO |
fea681da | 74 | .BR copysign (3) |