There are four different versions of the math library routines: IEEE,
POSIX, X/Open, or SVID. The version may be selected at runtime by
setting the global variable _LIB_VERSION
, defined in
`math.h'. It may be set to one of the following constants defined
in `math.h': _IEEE_
, _POSIX_
, _XOPEN_
, or
_SVID_
. The _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 matherr
function is never called, no warning
messages are printed, and errno
is never set.
In POSIX mode, errno
is set correctly, but the matherr
function is never called and no warning messages are printed.
In X/Open mode, errno
is set correctly, and matherr
is
called, but warning message are not printed.
In SVID mode, functions which overflow return 3.40282346638528860e+38,
the maximum single precision floating point value, rather than infinity.
Also, errno
is set correctly, matherr
is called, and, if
matherr
returns 0, warning messages are printed for some errors.
For example, by default `log(-1.0)' writes this message on standard
error output:
log: DOMAIN error
The library is set to X/Open mode by default.