man-pages/man3/signbit.3

35 lines
907 B
Groff
Raw Normal View History

2004-11-03 13:51:07 +00:00
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" Based on glibc infopages
.TH SIGNBIT 3 2002-08-10 "GNU" "Linux Programmer's Manual"
2004-11-03 13:51:07 +00:00
.SH NAME
signbit \- test sign of a real floating point number
.SH SYNOPSIS
.B "#include <math.h>"
.sp
2007-12-17 17:04:19 +00:00
.BI "int signbit(" x ");"
2004-11-03 13:51:07 +00:00
.sp
Compile with \fI\-std=c99\fP; link with \fI\-lm\fP.
2004-11-03 13:51:07 +00:00
.SH DESCRIPTION
2007-12-17 17:04:19 +00:00
.BR signbit ()
is a generic macro which can work on all real floating-point types.
It returns a non-zero value if the value of
.I x
has its sign bit set.
2004-11-03 13:51:07 +00:00
.PP
2007-12-17 17:04:19 +00:00
This is not the same as
.IR "x < 0.0" ,
because IEEE 754 floating point
allows zero to be signed.
2007-12-17 17:04:19 +00:00
The comparison
.IR "-0.0 < 0.0"
is false, but
.IR "signbit(\-0.0)"
will return a non-zero value.
2004-11-03 13:51:07 +00:00
.SH "CONFORMING TO"
C99.
This function is defined in IEC 559 (and the appendix with
2004-11-03 13:51:07 +00:00
recommended functions in IEEE 754/IEEE 854).
.SH "SEE ALSO"
.BR copysign (3)