]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/signbit.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / signbit.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6 .\" Distributed under GPL
7 .\" %%%LICENSE_END
8 .\"
9 .\" Based on glibc infopages, copyright Free Software Foundation
10 .\"
11 .TH SIGNBIT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
12 .SH NAME
13 signbit \- test sign of a real floating-point number
14 .SH SYNOPSIS
15 .B "#include <math.h>"
16 .PP
17 .BI "int signbit(" x ");"
18 .PP
19 Link with \fI\-lm\fP.
20 .PP
21 .in -4n
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .in
25 .PP
26 .ad l
27 .BR signbit ():
28 .RS 4
29 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
30 .RE
31 .ad
32 .SH DESCRIPTION
33 .BR signbit ()
34 is a generic macro which can work on all real floating-point types.
35 It returns a nonzero value if the value of
36 .I x
37 has its sign bit set.
38 .PP
39 This is not the same as
40 .IR "x < 0.0" ,
41 because IEEE 754 floating point allows zero to be signed.
42 The comparison
43 .IR "-0.0 < 0.0"
44 is false, but
45 .IR "signbit(\-0.0)"
46 will return a nonzero value.
47 .PP
48 NaNs and infinities have a sign bit.
49 .SH RETURN VALUE
50 The
51 .BR signbit ()
52 macro returns nonzero if the sign of
53 .I x
54 is negative; otherwise it returns zero.
55 .SH ERRORS
56 No errors occur.
57 .SH ATTRIBUTES
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{
66 .BR signbit ()
67 T} Thread safety MT-Safe
68 .TE
69 .SH CONFORMING TO
70 POSIX.1-2001, POSIX.1-2008, C99.
71 This function is defined in IEC 559 (and the appendix with
72 recommended functions in IEEE 754/IEEE 854).
73 .SH SEE ALSO
74 .BR copysign (3)