From 29d1299f4e32fbc1ae623d9826e81b2cdb8465aa Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 19 Jul 2024 19:49:20 +0200 Subject: [PATCH] doc: Add documentation about math_errhandling. * doc/posix-functions/math_errhandling.texi: New file. * doc/gnulib.texi (Function Substitutes): Include it. --- ChangeLog | 6 ++++ doc/gnulib.texi | 2 ++ doc/posix-functions/math_errhandling.texi | 34 +++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 doc/posix-functions/math_errhandling.texi diff --git a/ChangeLog b/ChangeLog index 4e88d446a1..6f3b910d5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-07-19 Bruno Haible + + doc: Add documentation about math_errhandling. + * doc/posix-functions/math_errhandling.texi: New file. + * doc/gnulib.texi (Function Substitutes): Include it. + 2024-07-19 Paul Eggert xstrtol: be more robust against odd failures diff --git a/doc/gnulib.texi b/doc/gnulib.texi index f538925d8d..683d2aabca 100644 --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -1907,6 +1907,7 @@ problems are not worked around by Gnulib. * lseek:: * lstat:: * malloc:: +* math_errhandling:: * mblen:: * mbrlen:: * mbrtoc8:: @@ -3303,6 +3304,7 @@ problems are not worked around by Gnulib. @include posix-functions/lseek.texi @include posix-functions/lstat.texi @include posix-functions/malloc.texi +@include posix-functions/math_errhandling.texi @include posix-functions/mblen.texi @include posix-functions/mbrlen.texi @include posix-functions/mbrtoc8.texi diff --git a/doc/posix-functions/math_errhandling.texi b/doc/posix-functions/math_errhandling.texi new file mode 100644 index 0000000000..f897a5ec4b --- /dev/null +++ b/doc/posix-functions/math_errhandling.texi @@ -0,0 +1,34 @@ +@node math_errhandling +@section @code{math_errhandling} +@findex math_errhandling + +ISO C23 specification:@* @url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf} section 7.12.1 + +Documentation:@* @uref{https://www.kernel.org/doc/man-pages/online/pages/man7/math_error.7.html,,man math_error} + +Gnulib module: --- + +Portability problems fixed by Gnulib: +@itemize +@end itemize + +Portability problems not fixed by Gnulib: +@itemize +@item +This macro is missing on some platforms: +NetBSD 10.0, mingw. +@item +This macro does not describe the error behaviour +of elementary arithmetic operations (+, -, *, /) +and of mathematical operations for which the compiler emits inline code +(such as @code{sqrt} on some CPUs). +@item +This macro does not describe the error behaviour of functions +such as @code{strtod}. +@item +For mathematical operations in general, it is a safer bet to look +at the exceptions set in the floating-point environment +(by calling @code{feclearexcept (FE_ALL_EXCEPT)} before the operation +and @code{fetestexcept} after the operation), +regardless of @code{math_errhandling}. +@end itemize -- 2.39.5