OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libm/] [math/] [math.tex] - Diff between revs 57 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 57 Rev 1765
@node Math
@node Math
@chapter Mathematical Functions (@file{math.h})
@chapter Mathematical Functions (@file{math.h})
 
 
This chapter groups a wide variety of mathematical functions.  The
This chapter groups a wide variety of mathematical functions.  The
corresponding definitions and declarations are in @file{math.h}.
corresponding definitions and declarations are in @file{math.h}.
Two definitions from @file{math.h} are of particular interest.
Two definitions from @file{math.h} are of particular interest.
 
 
@enumerate
@enumerate
@item
@item
The representation of infinity as a @code{double} is defined as
The representation of infinity as a @code{double} is defined as
@code{HUGE_VAL}; this number is returned on overflow by many functions.
@code{HUGE_VAL}; this number is returned on overflow by many functions.
 
 
@item
@item
The structure @code{exception} is used when you write customized error
The structure @code{exception} is used when you write customized error
handlers for the mathematical functions.  You can customize error
handlers for the mathematical functions.  You can customize error
handling for most of these functions by defining your own version of
handling for most of these functions by defining your own version of
@code{matherr}; see the section on @code{matherr} for details.
@code{matherr}; see the section on @code{matherr} for details.
@end enumerate
@end enumerate
 
 
@cindex system calls
@cindex system calls
@cindex support subroutines
@cindex support subroutines
@cindex stubs
@cindex stubs
@cindex OS stubs
@cindex OS stubs
Since the error handling code calls @code{fputs}, the mathematical
Since the error handling code calls @code{fputs}, the mathematical
subroutines require stubs or minimal implementations for the same list
subroutines require stubs or minimal implementations for the same list
of OS subroutines as @code{fputs}: @code{close}, @code{fstat},
of OS subroutines as @code{fputs}: @code{close}, @code{fstat},
@code{isatty}, @code{lseek}, @code{read}, @code{sbrk}, @code{write}.
@code{isatty}, @code{lseek}, @code{read}, @code{sbrk}, @code{write}.
@xref{syscalls,,System Calls, libc.info, The Cygnus C Support Library},
@xref{syscalls,,System Calls, libc.info, The Cygnus C Support Library},
for a discussion and for sample minimal implementations of these support
for a discussion and for sample minimal implementations of these support
subroutines.
subroutines.
 
 
Alternative declarations of the mathematical functions, which exploit
Alternative declarations of the mathematical functions, which exploit
specific machine capabilities to operate faster---but generally have
specific machine capabilities to operate faster---but generally have
less error checking and may reflect additional limitations on some
less error checking and may reflect additional limitations on some
machines---are available when you include @file{fastmath.h} instead of
machines---are available when you include @file{fastmath.h} instead of
@file{math.h}.
@file{math.h}.
 
 
@menu
@menu
* version::     Version of library
* version::     Version of library
* acos::        Arccosine
* acos::        Arccosine
* acosh::       Inverse hyperbolic cosine
* acosh::       Inverse hyperbolic cosine
* asin::        Arcsine
* asin::        Arcsine
* asinh::       Inverse hyperbolic sine
* asinh::       Inverse hyperbolic sine
* atan::        Arctangent
* atan::        Arctangent
* atan2::       Arctangent of y/x
* atan2::       Arctangent of y/x
* atanh::       Inverse hyperbolic tangent
* atanh::       Inverse hyperbolic tangent
* jN::          Bessel functions  (jN, yN)
* jN::          Bessel functions  (jN, yN)
* cbrt::        Cube root
* cbrt::        Cube root
* copysign::    Sign of Y, magnitude of X
* copysign::    Sign of Y, magnitude of X
* cosh::        Hyperbolic cosine
* cosh::        Hyperbolic cosine
* erf::         Error function  (erf, erfc)
* erf::         Error function  (erf, erfc)
* exp::         Exponential
* exp::         Exponential
* expm1::       Exponential of x, - 1
* expm1::       Exponential of x, - 1
* fabs::        Absolute value (magnitude)
* fabs::        Absolute value (magnitude)
* floor::       Floor and ceiling  (floor, ceil)
* floor::       Floor and ceiling  (floor, ceil)
* fmod::        Floating-point remainder (modulo)
* fmod::        Floating-point remainder (modulo)
* frexp::       Split floating-point number
* frexp::       Split floating-point number
* gamma::       Logarithmic gamma function
* gamma::       Logarithmic gamma function
* hypot::       Distance from origin
* hypot::       Distance from origin
* ilogb::       Get exponent
* ilogb::       Get exponent
* infinity::    Floating infinity
* infinity::    Floating infinity
* isnan::       Check type of number
* isnan::       Check type of number
* ldexp::       Load exponent
* ldexp::       Load exponent
* log::         Natural logarithms
* log::         Natural logarithms
* log10::       Base 10 logarithms
* log10::       Base 10 logarithms
* log1p::       Log of 1 + X
* log1p::       Log of 1 + X
* matherr::     Modifiable math error handler
* matherr::     Modifiable math error handler
* modf::        Split fractional and integer parts
* modf::        Split fractional and integer parts
* nan::         Floating Not a Number
* nan::         Floating Not a Number
* nextafter::   Get next representable number
* nextafter::   Get next representable number
* pow::         X to the power Y
* pow::         X to the power Y
* remainder::   remainder of X divided by Y
* remainder::   remainder of X divided by Y
* scalbn::      scalbn
* scalbn::      scalbn
* sin::         Sine or cosine (sin, cos)
* sin::         Sine or cosine (sin, cos)
* sinh::        Hyperbolic sine
* sinh::        Hyperbolic sine
* sqrt::        Positive square root
* sqrt::        Positive square root
* tan::         Tangent
* tan::         Tangent
* tanh::        Hyperbolic tangent
* tanh::        Hyperbolic tangent
@end menu
@end menu
 
 
@page
@page
@node version
@node version
@section Version of library
@section Version of library
 
 
There are four different versions of the math library routines: IEEE,
There are four different versions of the math library routines: IEEE,
POSIX, X/Open, or SVID.  The version may be selected at runtime by
POSIX, X/Open, or SVID.  The version may be selected at runtime by
setting the global variable @code{_LIB_VERSION}, defined in
setting the global variable @code{_LIB_VERSION}, defined in
@file{math.h}.  It may be set to one of the following constants defined
@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
in @file{math.h}: @code{_IEEE_}, @code{_POSIX_}, @code{_XOPEN_}, or
@code{_SVID_}.  The @code{_LIB_VERSION} variable is not specific to any
@code{_SVID_}.  The @code{_LIB_VERSION} variable is not specific to any
thread, and changing it will affect all threads.
thread, and changing it will affect all threads.
 
 
The versions of the library differ only in how errors are handled.
The versions of the library differ only in how errors are handled.
 
 
In IEEE mode, the @code{matherr} function is never called, no warning
In IEEE mode, the @code{matherr} function is never called, no warning
messages are printed, and @code{errno} is never set.
messages are printed, and @code{errno} is never set.
 
 
In POSIX mode, @code{errno} is set correctly, but the @code{matherr}
In POSIX mode, @code{errno} is set correctly, but the @code{matherr}
function is never called and no warning messages are printed.
function is never called and no warning messages are printed.
 
 
In X/Open mode, @code{errno} is set correctly, and @code{matherr} is
In X/Open mode, @code{errno} is set correctly, and @code{matherr} is
called, but warning message are not printed.
called, but warning message are not printed.
 
 
In SVID mode, functions which overflow return 3.40282346638528860e+38,
In SVID mode, functions which overflow return 3.40282346638528860e+38,
the maximum single precision floating point value, rather than infinity.
the maximum single precision floating point value, rather than infinity.
Also, @code{errno} is set correctly, @code{matherr} is called, and, if
Also, @code{errno} is set correctly, @code{matherr} is called, and, if
@code{matherr} returns 0, warning messages are printed for some errors.
@code{matherr} returns 0, warning messages are printed for some errors.
For example, by default @samp{log(-1.0)} writes this message on standard
For example, by default @samp{log(-1.0)} writes this message on standard
error output:
error output:
 
 
@example
@example
log: DOMAIN error
log: DOMAIN error
@end example
@end example
 
 
The library is set to X/Open mode by default.
The library is set to X/Open mode by default.
 
 
@page
@page
@include math/wacos.def
@include math/wacos.def
 
 
@page
@page
@include math/wacosh.def
@include math/wacosh.def
 
 
@page
@page
@include math/wasin.def
@include math/wasin.def
 
 
@page
@page
@include math/sasinh.def
@include math/sasinh.def
 
 
@page
@page
@include math/satan.def
@include math/satan.def
 
 
@page
@page
@include math/watan2.def
@include math/watan2.def
 
 
@page
@page
@include math/watanh.def
@include math/watanh.def
 
 
@page
@page
@include math/wj0.def
@include math/wj0.def
 
 
@page
@page
@include math/wcosh.def
@include math/wcosh.def
 
 
@page
@page
@include math/serf.def
@include math/serf.def
 
 
@page
@page
@include math/wexp.def
@include math/wexp.def
 
 
@page
@page
@include math/sfabs.def
@include math/sfabs.def
 
 
@page
@page
@include math/sfloor.def
@include math/sfloor.def
 
 
@page
@page
@include math/wfmod.def
@include math/wfmod.def
 
 
@page
@page
@include math/sfrexp.def
@include math/sfrexp.def
 
 
@page
@page
@include math/wgamma.def
@include math/wgamma.def
 
 
@page
@page
@include math/whypot.def
@include math/whypot.def
 
 
@page
@page
@include math/sisnan.def
@include math/sisnan.def
 
 
@page
@page
@include math/sldexp.def
@include math/sldexp.def
 
 
@page
@page
@include math/wlog.def
@include math/wlog.def
 
 
@page
@page
@include math/wlog10.def
@include math/wlog10.def
 
 
@page
@page
@include math/wpow.def
@include math/wpow.def
 
 
@page
@page
@include math/wremainder.def
@include math/wremainder.def
 
 
@page
@page
@include math/wsqrt.def
@include math/wsqrt.def
 
 
@page
@page
@include math/ssin.def
@include math/ssin.def
 
 
@page
@page
@include math/wsinh.def
@include math/wsinh.def
 
 
@page
@page
@include math/stan.def
@include math/stan.def
 
 
@page
@page
@include math/stanh.def
@include math/stanh.def
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.