summaryrefslogtreecommitdiff
path: root/man3/fpclassify.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/fpclassify.3')
-rw-r--r--man3/fpclassify.380
1 files changed, 80 insertions, 0 deletions
diff --git a/man3/fpclassify.3 b/man3/fpclassify.3
new file mode 100644
index 000000000..0c317f506
--- /dev/null
+++ b/man3/fpclassify.3
@@ -0,0 +1,80 @@
+.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
+.\" Distributed under GPL, 2002-07-27 Walter Harms
+.\" This was done with the help of the glibc manual.
+.\"
+.\" 2004-10-31, aeb, corrected
+.TH fpclassify 3 2004-10-31 "" "Linux Programmer's Manual"
+.SH NAME
+fpclassify, isfinite, isnormal, isnan \- floating-point classification macros
+.SH SYNOPSIS
+.nf
+.B #include <math.h>
+.sp
+.BI "int fpclassify(" x );
+.sp
+.BI "int isfinite(" x );
+.sp
+.BI "int isnormal(" x );
+.sp
+.BI "int isnan(" x );
+.sp
+.BI "int isinf(" x );
+.fi
+.SH DESCRIPTION
+Floating point numbers can have special values, such as
+infinite or NaN. With the macro
+.BI fpclassify( x )
+you can find out what type
+.I x
+is. The macro takes any floating-point expression as argument.
+The result takes one of the following values:
+.TP
+FP_NAN
+.I x
+is "Not a Number".
+.TP
+FP_INFINITE
+.I x
+is either plus or minus infinity.
+.TP
+FP_ZERO
+.I x
+is zero.
+.TP
+FP_SUBNORMAL
+.I x
+is too small to be represented in normalized format.
+.TP
+FP_NORMAL
+if nothing of the above is correct that it must be a
+normal floating-point number.
+.LP
+The other macros provide a short answer to some standard questions.
+.TP
+.BI isfinite( x )
+returns a nonzero value if
+.br
+(fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
+.TP
+.BI isnormal( x )
+returns a nonzero value if
+(fpclassify(x) == FP_NORMAL)
+.TP
+.BI isnan( x )
+returns a nonzero value if
+(fpclassify(x) == FP_NAN)
+.TP
+.BI isinf( x )
+returns a nonzero value if
+(fpclassify(x) == FP_INFINITE)
+.SH NOTE
+On systems conforming to BSD 4.3,
+.B isinf()
+will return 1 for positive, and \-1 for negative infinity.
+.SH "CONFORMING TO"
+C99
+.SH "SEE ALSO"
+.BR finite (3),
+.BR INFINITY (3),
+.BR isgreater (3)
+