]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/signbit.3
update timestamp
[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 .\" Distributed under GPL
5 .\" Based on glibc infopages
6 .TH SIGNBIT 3 2008-08-05 "GNU" "Linux Programmer's Manual"
7 .SH NAME
8 signbit \- test sign of a real floating-point number
9 .SH SYNOPSIS
10 .B "#include <math.h>"
11 .sp
12 .BI "int signbit(" x ");"
13 .sp
14 Link with \fI\-lm\fP.
15 .sp
16 .in -4n
17 Feature Test Macro Requirements for glibc (see
18 .BR feature_test_macros (7)):
19 .in
20 .sp
21 .ad l
22 .BR signbit ():
23 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
24 .I cc\ -std=c99
25 .ad b
26 .SH DESCRIPTION
27 .BR signbit ()
28 is a generic macro which can work on all real floating-point types.
29 It returns a non-zero value if the value of
30 .I x
31 has its sign bit set.
32 .PP
33 This is not the same as
34 .IR "x < 0.0" ,
35 because IEEE 754 floating point allows zero to be signed.
36 The comparison
37 .IR "-0.0 < 0.0"
38 is false, but
39 .IR "signbit(\-0.0)"
40 will return a non-zero value.
41
42 NaNs and infinities have a sign bit.
43 .SH RETURN VALUE
44 The
45 .BR signbit ()
46 macro returns non-zero if the sign of
47 .x
48 is negative; otherwise it returns zero.
49 .SH ERRORS
50 No errors occur.
51 .SH "CONFORMING TO"
52 C99, POSIX.1-2001.
53 This function is defined in IEC 559 (and the appendix with
54 recommended functions in IEEE 754/IEEE 854).
55 .SH "SEE ALSO"
56 .BR copysign (3)