]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/matherr.3
fuse.4: ffix
[thirdparty/man-pages.git] / man3 / matherr.3
index af761daa5ae807eafa6644be41174b556feec78c..d7605a0553a533a5c08a4b0e3d4e0f9d43ec6788 100644 (file)
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH MATHERR 3 2014-06-13 "Linux" "Linux Programmer's Manual"
+.TH MATHERR 3 2017-09-15 "Linux" "Linux Programmer's Manual"
 .SH NAME
 matherr \- SVID math library exception handling
 .SH SYNOPSIS
 .nf
-.BR "#define _SVID_SOURCE" "             /* See feature_test_macros(7) */"
 .B #include <math.h>
-
+.PP
 .BI "int matherr(struct exception *" exc );
-
+.PP
 .B extern _LIB_VERSION_TYPE _LIB_VERSION;
 .fi
-.sp
+.PP
 Link with \fI\-lm\fP.
 .SH DESCRIPTION
+.IR Note :
+the mechanism described in this page is no longer supported by glibc.
+Before glibc 2.27, it had been marked as obsolete.
+Since glibc 2.27,
+.\" glibc commit 813378e9fe17e029caf627cab76fe23eb46815fa
+the mechanism has been removed altogether.
+New applications should use the techniques described in
+.BR math_error (7)
+and
+.BR fenv (3).
+This page documents the
+.BR matherr ()
+mechanism as an aid for maintaining and porting older applications.
+.PP
 The System V Interface Definition (SVID) specifies that various
 math functions should invoke a function called
 .BR matherr ()
@@ -48,18 +61,7 @@ after
 .BR matherr ()
 returns, the system then returns to the math function,
 which in turn returns to the caller.
-
-The
-.BR matherr ()
-mechanism is supported by glibc, but is now obsolete:
-new applications should use the techniques described in
-.BR math_error (7)
-and
-.BR fenv (3).
-This page documents the glibc
-.BR matherr ()
-mechanism as an aid for maintaining and porting older applications.
-
+.PP
 To employ
 .BR matherr (),
 the programmer must define the
@@ -72,7 +74,7 @@ and assign the value
 .B _SVID_
 to the external variable
 .BR _LIB_VERSION .
-
+.PP
 The system provides a default version of
 .BR matherr ().
 This version does nothing, and returns zero
@@ -84,9 +86,9 @@ version, which will be invoked when an exception occurs.
 The function is invoked with one argument, a pointer to an
 .I exception
 structure, defined as follows:
-
+.PP
 .in +4n
-.nf
+.EX
 struct exception {
     int    type;      /* Exception type */
     char  *name;      /* Name of function causing exception */
@@ -94,7 +96,7 @@ struct exception {
     double arg2;      /* 2nd argument to function */
     double retval;    /* Function return value */
 }
-.fi
+.EE
 .in
 .PP
 The
@@ -155,7 +157,7 @@ and
 fields are the arguments supplied to the function
 .RI ( arg2
 is undefined for functions that take only one argument).
-
+.PP
 The
 .I retval
 field specifies the return value that the math
@@ -163,14 +165,14 @@ function will return to its caller.
 The programmer-defined
 .BR matherr ()
 can modify this field to change the return value of the math function.
-
+.PP
 If the
 .BR matherr ()
 function returns zero, then the system sets
 .I errno
 as described above, and may print an error message on standard error
 (see below).
-
+.PP
 If the
 .BR matherr ()
 function returns a nonzero value, then the system does not set
@@ -186,17 +188,17 @@ when calling
 .BR matherr ().
 The "Result" column is the default return value assigned to
 .IR exc\->retval .
-
+.PP
 The "Msg?" and "errno" columns describe the default behavior if
 .BR matherr ()
 returns zero.
 If the "Msg?" columns contains "y",
 then the system prints an error message on standard error.
-
+.PP
 The table uses the following notations and abbreviations:
+.PP
 .RS
 .nf
-
 x        first argument to function
 y        second argument to function
 fin      finite value for argument
@@ -273,10 +275,17 @@ fmod(x,0) DOMAIN  x       y       EDOM
 remainder(x,0) DOMAIN  NAN     y       EDOM    \" retval is 0.0/0.0
 .TE
 .SH ATTRIBUTES
-.SS Multithreading (see pthreads(7))
-The
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lb lb lb
+l l l.
+Interface      Attribute       Value
+T{
 .BR matherr ()
-function is thread-safe.
+T}     Thread safety   MT-Safe
+.TE
 .SH EXAMPLE
 The example program demonstrates the use of
 .BR matherr ()
@@ -298,26 +307,26 @@ If the optional third command-line argument is supplied,
 then it specifies an alternative return value that
 .BR matherr ()
 should assign as the return value of the math function.
-
+.PP
 The following example run, where
 .BR log (3)
 is given an argument of 0.0, does not use
 .BR matherr ():
-
+.PP
 .in +4n
-.nf
+.EX
 .RB "$" " ./a.out 0.0"
 errno: Numerical result out of range
 x=-inf
-.fi
+.EE
 .in
-
+.PP
 In the following run,
 .BR matherr ()
 is called, and returns 0:
-
+.PP
 .in +4n
-.nf
+.EX
 .RB "$" " ./a.out 0.0 0"
 matherr SING exception in log() function
         args:   0.000000, 0.000000
@@ -325,46 +334,46 @@ matherr SING exception in log() function
 log: SING error
 errno: Numerical argument out of domain
 x=-340282346638528859811704183484516925440.000000
-.fi
+.EE
 .in
-
+.PP
 The message "log: SING error" was printed by the C library.
-
+.PP
 In the following run,
 .BR matherr ()
 is called, and returns a nonzero value:
-
+.PP
 .in +4n
-.nf
+.EX
 .RB "$" " ./a.out 0.0 1"
 matherr SING exception in log() function
         args:   0.000000, 0.000000
         retval: \-340282346638528859811704183484516925440.000000
 x=-340282346638528859811704183484516925440.000000
-.fi
+.EE
 .in
-
+.PP
 In this case, the C library did not print a message, and
 .I errno
 was not set.
-
+.PP
 In the following run,
 .BR matherr ()
 is called, changes the return value of the math function,
 and returns a nonzero value:
-
+.PP
 .in +4n
-.nf
+.EX
 .RB "$" " ./a.out 0.0 1 12345.0"
 matherr SING exception in log() function
         args:   0.000000, 0.000000
         retval: \-340282346638528859811704183484516925440.000000
 x=12345.000000
-.fi
+.EE
 .in
 .SS Program source
 \&
-.nf
+.EX
 #define _SVID_SOURCE
 #include <errno.h>
 #include <math.h>
@@ -426,7 +435,7 @@ main(int argc, char *argv[])
     printf("x=%f\\n", x);
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .BR fenv (3),
 .BR math_error (7),