aboutsummaryrefslogtreecommitdiffstats
path: root/man7/math_error.7
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2008-08-11 16:35:43 +0000
committerMichael Kerrisk <mtk.manpages@gmail.com>2008-08-11 16:35:43 +0000
commit00df6756ac93d79b8ef103605d3eb576ef9be21f (patch)
treece9ca9b63825dc95cde9870851a17819789b3d36 /man7/math_error.7
parent89c2514824c677b26b8fbd7dfbe373156b7596a3 (diff)
downloadman-pages-00df6756ac93d79b8ef103605d3eb576ef9be21f.tar.gz
Rewrite introductory paragraph.
Point out that a NaN is commonly returned by functions that report a domain error.
Diffstat (limited to 'man7/math_error.7')
-rw-r--r--man7/math_error.717
1 files changed, 10 insertions, 7 deletions
diff --git a/man7/math_error.7 b/man7/math_error.7
index 8662768dfa..1f6fb519a1 100644
--- a/man7/math_error.7
+++ b/man7/math_error.7
@@ -21,7 +21,7 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
-.TH MATH_ERROR 7 2008-07-30 "Linux" "Linux Programmer's Manual"
+.TH MATH_ERROR 7 2008-08-11 "Linux" "Linux Programmer's Manual"
.SH NAME
math_error \- detecting errors from mathematical functions
.SH SYNOPSIS
@@ -31,13 +31,14 @@ math_error \- detecting errors from mathematical functions
.B #include <fenv.h>
.fi
.SH DESCRIPTION
-On error, many of the mathematical functions declared in
+When an error occurs,
+most library functions indicate this fact by returning a special value
+(e.g., \-1 or NULL).
+Because they typically return a floating-point number,
+the mathematical functions declared in
.IR <math.h>
-return a NaN (not a number).
-However, rather than looking at the return value
-(which is not always possible)
-one can also check whether an error was signaled.
-There are two signaling mechanisms:
+indicate an error using other mechanisms.
+There are two error-reporting mechanisms:
the older one sets
.IR errno ;
the newer one uses the floating-point exception mechanism (the use of
@@ -95,6 +96,8 @@ value falls outside the domain for which the function
is defined (e.g., giving a negative argument to
.BR log (3)).
When a domain error occurs,
+math functions commonly return a NaN
+(though some functions return a different value in this case);
.I errno
is set to
.BR EDOM ,