summaryrefslogtreecommitdiffstats
path: root/man3/matherr.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/matherr.3')
-rw-r--r--man3/matherr.328
1 files changed, 13 insertions, 15 deletions
diff --git a/man3/matherr.3 b/man3/matherr.3
index 1a2805cce..8e9a9738d 100644
--- a/man3/matherr.3
+++ b/man3/matherr.3
@@ -4,7 +4,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH matherr 3 2023-02-05 "Linux man-pages 6.03"
+.TH matherr 3 2023-07-20 "Linux man-pages 6.05.01"
.SH NAME
matherr \- SVID math library exception handling
.SH LIBRARY
@@ -259,19 +259,17 @@ remainder(x,0) DOMAIN NAN y EDOM \" retval is 0.0/0.0
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
-.ad l
-.nh
.TS
allbox;
lbx lb lb
l l l.
Interface Attribute Value
T{
+.na
+.nh
.BR matherr ()
T} Thread safety MT-Safe
.TE
-.hy
-.ad
.sp 1
.SH EXAMPLES
The example program demonstrates the use of
@@ -367,13 +365,13 @@ x=12345.000000
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-
+\&
static int matherr_ret = 0; /* Value that matherr()
should return */
static int change_retval = 0; /* Should matherr() change
function\[aq]s return value? */
static double new_retval; /* New function return value */
-
+\&
int
matherr(struct exception *exc)
{
@@ -388,38 +386,38 @@ matherr(struct exception *exc)
fprintf(stderr, " args: %f, %f\en",
exc\->arg1, exc\->arg2);
fprintf(stderr, " retval: %f\en", exc\->retval);
-
+\&
if (change_retval)
exc\->retval = new_retval;
-
+\&
return matherr_ret;
}
-
+\&
int
main(int argc, char *argv[])
{
double x;
-
+\&
if (argc < 2) {
fprintf(stderr, "Usage: %s <argval>"
" [<matherr\-ret> [<new\-func\-retval>]]\en", argv[0]);
exit(EXIT_FAILURE);
}
-
+\&
if (argc > 2) {
_LIB_VERSION = _SVID_;
matherr_ret = atoi(argv[2]);
}
-
+\&
if (argc > 3) {
change_retval = 1;
new_retval = atof(argv[3]);
}
-
+\&
x = log(atof(argv[1]));
if (errno != 0)
perror("errno");
-
+\&
printf("x=%f\en", x);
exit(EXIT_SUCCESS);
}