OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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 2013-07-04 "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 .sp
17 .BI  "int signbit(" x ");"
18 .sp
19 Link with \fI\-lm\fP.
20 .sp
21 .in -4n
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .in
25 .sp
26 .ad l
27 .BR signbit ():
28 .RS 4
29 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
30 _POSIX_C_SOURCE\ >=\ 200112L;
31 .br
32 or
33 .I cc\ -std=c99
34 .RE
35 .ad
36 .SH DESCRIPTION
37 .BR signbit ()
38 is a generic macro which can work on all real floating-point types.
39 It returns a nonzero value if the value of
40 .I x
41 has its sign bit set.
42 .PP
43 This is not the same as
44 .IR "x < 0.0" ,
45 because IEEE 754 floating point allows zero to be signed.
46 The comparison
47 .IR "-0.0 < 0.0"
48 is false, but
49 .IR "signbit(\-0.0)"
50 will return a nonzero value.
51
52 NaNs and infinities have a sign bit.
53 .SH RETURN VALUE
54 The
55 .BR signbit ()
56 macro returns nonzero if the sign of
57 .I x
58 is negative; otherwise it returns zero.
59 .SH ERRORS
60 No errors occur.
61 .SH ATTRIBUTES
62 .SS Multithreading (see pthreads(7))
63 The
64 .BR signbit ()
65 macro is thread-safe.
66 .SH CONFORMING TO
67 C99, POSIX.1-2001.
68 This function is defined in IEC 559 (and the appendix with
69 recommended functions in IEEE 754/IEEE 854).
70 .SH SEE ALSO
71 .BR copysign (3)
72 .SH COLOPHON
73 This page is part of release 3.79 of the Linux
74 .I man-pages
75 project.
76 A description of the project,
77 information about reporting bugs,
78 and the latest version of this page,
79 can be found at
80 \%http://www.kernel.org/doc/man\-pages/.