diff options
Diffstat (limited to 'newlib/libm/math/math.tex')
-rw-r--r-- | newlib/libm/math/math.tex | 58 |
1 files changed, 10 insertions, 48 deletions
diff --git a/newlib/libm/math/math.tex b/newlib/libm/math/math.tex index a6f931b3e..92b384f63 100644 --- a/newlib/libm/math/math.tex +++ b/newlib/libm/math/math.tex @@ -3,33 +3,15 @@ This chapter groups a wide variety of mathematical functions. The corresponding definitions and declarations are in @file{math.h}. -Two definitions from @file{math.h} are of particular interest. +The definition of HUGE_VAL from @file{math.h} is of particular interest. @enumerate @item The representation of infinity as a @code{double} is defined as @code{HUGE_VAL}; this number is returned on overflow by many functions. The macro @code{HUGE_VALF} is a corresponding value for @code{float}. - -@item -The structure @code{exception} is used when you write customized error -handlers for the mathematical functions. You can customize error -handling for most of these functions by defining your own version of -@code{matherr}; see the section on @code{matherr} for details. @end enumerate -@cindex system calls -@cindex support subroutines -@cindex stubs -@cindex OS stubs -Since the error handling code calls @code{fputs}, the mathematical -subroutines require stubs or minimal implementations for the same list -of OS subroutines as @code{fputs}: @code{close}, @code{fstat}, -@code{isatty}, @code{lseek}, @code{read}, @code{sbrk}, @code{write}. -@xref{syscalls,,System Calls, libc.info, The Red Hat newlib C Library}, -for a discussion and for sample minimal implementations of these support -subroutines. - Alternative declarations of the mathematical functions, which exploit specific machine capabilities to operate faster---but generally have less error checking and may reflect additional limitations on some @@ -76,7 +58,6 @@ machines---are available when you include @file{fastmath.h} instead of * logb:: Get exponent * lrint:: Round to integer * lround:: Round to integer, away from zero (lround, llround) -* matherr:: Modifiable math error handler * modf:: Split fractional and integer parts * nan:: Floating Not a Number * nearbyint:: Round to integer @@ -101,40 +82,23 @@ machines---are available when you include @file{fastmath.h} instead of @node version @section Error Handling -There are four different versions of the math library routines: IEEE, -POSIX, X/Open, or SVID. The version may be selected at runtime by +There are two different versions of the math library routines: IEEE +and POSIX. The version may be selected at runtime by setting the global variable @code{_LIB_VERSION}, defined in @file{math.h}. It may be set to one of the following constants defined -in @file{math.h}: @code{_IEEE_}, @code{_POSIX_}, @code{_XOPEN_}, or -@code{_SVID_}. The @code{_LIB_VERSION} variable is not specific to any +in @file{math.h}: @code{_IEEE_} or @code{_POSIX_}. +The @code{_LIB_VERSION} variable is not specific to any thread, and changing it will affect all threads. -The versions of the library differ only in how errors are handled. - -In IEEE mode, the @code{matherr} function is never called, no warning -messages are printed, and @code{errno} is never set. +The versions of the library differ only in the setting of @code{errno}. -In POSIX mode, @code{errno} is set correctly, but the @code{matherr} -function is never called and no warning messages are printed. +In IEEE mode, @code{errno} is never set. -In X/Open mode, @code{errno} is set correctly, and @code{matherr} is -called, but warning message are not printed. +In POSIX mode, @code{errno} is set correctly. -In SVID mode, functions which overflow return 3.40282346638528860e+38, -the maximum single-precision floating-point value, rather than infinity. -Also, @code{errno} is set correctly, @code{matherr} is called, and, if -@code{matherr} returns 0, warning messages are printed for some errors. -For example, by default @samp{log(-1.0)} writes this message on standard -error output: +The library is set to IEEE mode by default. -@example -log: DOMAIN error -@end example - -The library is set to X/Open mode by default. - -The aforementioned error reporting is the supported Newlib libm error -handling method. However, the majority of the functions are written +The majority of the floating-point math functions are written so as to produce the floating-point exceptions (e.g. "invalid", "divide-by-zero") as required by the C and POSIX standards, for floating-point implementations that support them. Newlib does not provide @@ -241,8 +205,6 @@ registered trademark of The IEEE. @page @include common/s_lround.def @page -@include common/s_matherr.def -@page @include common/s_modf.def @page @include common/s_nan.def |