Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2009-03-25 22:13:24 +0300
committerJeff Johnston <jjohnstn@redhat.com>2009-03-25 22:13:24 +0300
commit139f923bb4564fb021dce2b7ae460a3d8e3bb87d (patch)
tree96c1d8794c6828033a418bce8d8f1cc6eccba037 /newlib/libm/math
parentbaea11cd6a53ccde63b5fefa4c7ae2b5426a668d (diff)
2009-03-25 Craig Howland <howland@LGSInnovations.com>
* libc/include/math.h: (llround, llroundf): Declare. * libm/common/s_llround.c: New file, implementing llround(). * libm/common/sf_llround.c: New file, implementing llroundf(). * libm/common/sf_lround.c: Remove spurious cast in _DOUBLE_IS_32BITS version of function. * libm/common/sf_lrint.c: Ditto. * libm/common/sf_logb.c: Corrected return for subnormal argument by replacing existing function with a version created from sf_ilogb.c. * libm/common/s_logb.c: Ditto, except starting point s_ilogb.c. Also added documentation for logb() and logbf(). * libm/common/s_signbit.c: Add signbit() documentation. * libm/common/s_log2.c: Update return values to match what w_log2.c has, since log2 uses log(); add note about being derived instead of direct. * libm/common/sf_fma.c: Add casts to attempt to get correct results, as well as comments pointing out problems with the implementation. * libm/common/s_fma.c: Add fma() and fmaf() documentation. * libm/common/sf_remquo.c: Incorrect quotient returns for large values corrected by discarding existing function and replacing with Sun verion, with some enhancements. * libm/common/s_remquo.c: Ditto. Add remquo() and remquof() documentation. * libm/common/s_fmax.c: Add fmax() and fmaxf() documentation. * libm/common/s_fmin.c: Add fmin() and fminf() documentation. * libm/common/s_fdim.c: Return NAN for NAN arg, add fdim() and fdimf() documentation. * libm/common/sf_fdim.c: Return NAN for NAN arg, HUGE_VALF for inf arg. * libm/common/s_trunc.c: Add trunc() and truncf() documentation. * libm/common/s_rint.c: Add rint() and rintf() documentation. * libm/common/s_round.c: Add round() and roundf() documentation. * libm/common/s_scalbn.c: Add scalbln() and scalblnf() documentation. * libm/common/s_infinity.c: Add infinity() and infinityf() documentation. * libm/common/s_lround.c: Add lround(), lroundf(), llround(), and llroundf() documentation. * libm/common/s_lrint.c: Add lrint(), lrintf(), llrint(), and llrintf() documentation. * libm/common/isgreater.c: New file for documenting math.h function-like macros isgreater(), isgreaterequal(), isless(), islessequal(), islessgreater(), and isunordered(). * libm/common/s_isnan.c: Add documentation for function-like macros fpclassify(), isfinite(), isinf(), isnan(), and isnormal(). * libm/common/s_nearbyint.c: Add nearbyint() and nearbyintf() documentation. * libm/common/Makefile.am: Add s_llround.c (src); sf_llround.c (fsrc); s_fdim.def, s_fma.def, s_fmax.def, s_fmin.def, s_logb.def, s_lrint.def, s_lround.def, s_nearbyint.def, s_remquo.def, s_rint.def, s_round.def, s_signbit.def, s_trunc.def, and isgreater.def (chobj); re-name all existing chew files (chobj) to match source file base names (put in underscores), delete all special targets for chew files (leaving all to be generated by rule). * libm/common/Makefile.in: regenerate. * libm/math/w_exp2.c: Add "base 2" to documentation description (and delete TRAD_SYNOPSIS). * libm/math/w_gamma.c: Add tgamma() and tgammaf() documentation, along with some history behind the function names. * libm/math/math.tex: Add includes for newly-added documentation (see .def additions to common/Makefile.am and math/Makefile.am in this ChangeLog list), adjusted existing .def file names to match source file base names (added underscores); add mention of HUGE_VALF; rename "Version of library" section to "Error Handling" and add some text about floating-point exception; added section "Standards Compliance And Portability". * libm/math/Makefile.am: Add w_exp2.def (chobj); re-name all existing chew files (chobj) to match source file base names, delete all special targets for chew files (leaving all to be generated by rule). * libm/math/Makefile.in: regenerated * doc/makedoc.c: Change silent ignoring of commands < 5 characters to a failure when reading macro file for commands < 4 characters; add -v (verbose) option for printing some debugging information; get rid of spurious translation of "@*" to "*" (no source files used @*, so no existing doc pages were affected); clean up some compiler warnings. * doc/doc.str: add BUGS and SEEALSO sections (to match texi2pod.pl which has them); Remove ITEM command (redundant with makedoc built-in "o", not used in any present source file so nothing is lost, anyway). * HOWTO: New file to hold information for maintainers regarding how to do things. Initial sections on documentation and ELIX levels.
Diffstat (limited to 'newlib/libm/math')
-rw-r--r--newlib/libm/math/Makefile.am104
-rw-r--r--newlib/libm/math/Makefile.in104
-rw-r--r--newlib/libm/math/math.tex237
-rw-r--r--newlib/libm/math/w_exp2.c13
-rw-r--r--newlib/libm/math/w_gamma.c53
5 files changed, 175 insertions, 336 deletions
diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am
index 668254145..335817920 100644
--- a/newlib/libm/math/Makefile.am
+++ b/newlib/libm/math/Makefile.am
@@ -65,14 +65,14 @@ endif # USE_LIBTOOL
include $(srcdir)/../../Makefile.shared
-chobj = wacos.def wacosh.def wasin.def sasinh.def \
- satan.def watan2.def watanh.def wj0.def \
- wcosh.def serf.def wexp.def \
- sfabs.def sfloor.def wfmod.def sfrexp.def \
- wgamma.def whypot.def sldexp.def wlog.def \
- wlog10.def \
- wpow.def wremainder.def ssin.def wsinh.def \
- wsqrt.def stan.def stanh.def
+chobj = w_acos.def w_acosh.def w_asin.def s_asinh.def \
+ s_atan.def w_atan2.def w_atanh.def w_j0.def \
+ w_cosh.def s_erf.def w_exp.def w_exp2.def \
+ s_fabs.def s_floor.def w_fmod.def s_frexp.def \
+ w_gamma.def w_hypot.def s_ldexp.def w_log.def \
+ w_log10.def \
+ w_pow.def w_remainder.def s_sin.def w_sinh.def \
+ w_sqrt.def s_tan.def s_tanh.def
SUFFIXES = .def
@@ -89,94 +89,6 @@ doc: $(chobj)
CLEANFILES = $(chobj) *.ref
-# Texinfo does not appear to support underscores in file names, so we
-# name the .def files without underscores.
-
-wacos.def: w_acos.c
- $(CHEW) < $(srcdir)/w_acos.c >$@ 2>/dev/null
- touch stmp-def
-wacosh.def: w_acosh.c
- $(CHEW) < $(srcdir)/w_acosh.c >$@ 2>/dev/null
- touch stmp-def
-wasin.def: w_asin.c
- $(CHEW) < $(srcdir)/w_asin.c >$@ 2>/dev/null
- touch stmp-def
-sasinh.def: s_asinh.c
- $(CHEW) < $(srcdir)/s_asinh.c >$@ 2>/dev/null
- touch stmp-def
-satan.def: s_atan.c
- $(CHEW) < $(srcdir)/s_atan.c >$@ 2>/dev/null
- touch stmp-def
-watan2.def: w_atan2.c
- $(CHEW) < $(srcdir)/w_atan2.c >$@ 2>/dev/null
- touch stmp-def
-watanh.def: w_atanh.c
- $(CHEW) < $(srcdir)/w_atanh.c >$@ 2>/dev/null
- touch stmp-def
-wj0.def: w_j0.c
- $(CHEW) < $(srcdir)/w_j0.c >$@ 2>/dev/null
- touch stmp-def
-scopysign.def: s_copysign.c
- $(CHEW) < $(srcdir)/../common/s_copysign.c >$@ 2>/dev/null
- touch stmp-def
-wcosh.def: w_cosh.c
- $(CHEW) < $(srcdir)/w_cosh.c >$@ 2>/dev/null
- touch stmp-def
-serf.def: s_erf.c
- $(CHEW) < $(srcdir)/s_erf.c >$@ 2>/dev/null
- touch stmp-def
-wexp.def: w_exp.c
- $(CHEW) < $(srcdir)/w_exp.c >$@ 2>/dev/null
- touch stmp-def
-sfabs.def: s_fabs.c
- $(CHEW) < $(srcdir)/s_fabs.c >$@ 2>/dev/null
- touch stmp-def
-sfloor.def: s_floor.c
- $(CHEW) < $(srcdir)/s_floor.c >$@ 2>/dev/null
- touch stmp-def
-wfmod.def: w_fmod.c
- $(CHEW) < $(srcdir)/w_fmod.c >$@ 2>/dev/null
- touch stmp-def
-sfrexp.def: s_frexp.c
- $(CHEW) < $(srcdir)/s_frexp.c >$@ 2>/dev/null
- touch stmp-def
-wgamma.def: w_gamma.c
- $(CHEW) < $(srcdir)/w_gamma.c >$@ 2>/dev/null
- touch stmp-def
-whypot.def: w_hypot.c
- $(CHEW) < $(srcdir)/w_hypot.c >$@ 2>/dev/null
- touch stmp-def
-sldexp.def: s_ldexp.c
- $(CHEW) < $(srcdir)/s_ldexp.c >$@ 2>/dev/null
- touch stmp-def
-wlog.def: w_log.c
- $(CHEW) < $(srcdir)/w_log.c >$@ 2>/dev/null
- touch stmp-def
-wlog10.def: w_log10.c
- $(CHEW) < $(srcdir)/w_log10.c >$@ 2>/dev/null
- touch stmp-def
-wpow.def: w_pow.c
- $(CHEW) < $(srcdir)/w_pow.c >$@ 2>/dev/null
- touch stmp-def
-wremainder.def: w_remainder.c
- $(CHEW) < $(srcdir)/w_remainder.c >$@ 2>/dev/null
- touch stmp-def
-ssin.def: s_sin.c
- $(CHEW) < $(srcdir)/s_sin.c >$@ 2>/dev/null
- touch stmp-def
-wsinh.def: w_sinh.c
- $(CHEW) < $(srcdir)/w_sinh.c >$@ 2>/dev/null
- touch stmp-def
-wsqrt.def: w_sqrt.c
- $(CHEW) < $(srcdir)/w_sqrt.c >$@ 2>/dev/null
- touch stmp-def
-stan.def: s_tan.c
- $(CHEW) < $(srcdir)/s_tan.c >$@ 2>/dev/null
- touch stmp-def
-stanh.def: s_tanh.c
- $(CHEW) < $(srcdir)/s_tanh.c >$@ 2>/dev/null
- touch stmp-def
-
# A partial dependency list.
$(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h $(srcdir)/../common/fdlibm.h
diff --git a/newlib/libm/math/Makefile.in b/newlib/libm/math/Makefile.in
index 599623892..c0c3167f8 100644
--- a/newlib/libm/math/Makefile.in
+++ b/newlib/libm/math/Makefile.in
@@ -373,14 +373,14 @@ libmath_la_LDFLAGS = -Xcompiler -nostdlib
@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(src) $(fsrc)
@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
-chobj = wacos.def wacosh.def wasin.def sasinh.def \
- satan.def watan2.def watanh.def wj0.def \
- wcosh.def serf.def wexp.def \
- sfabs.def sfloor.def wfmod.def sfrexp.def \
- wgamma.def whypot.def sldexp.def wlog.def \
- wlog10.def \
- wpow.def wremainder.def ssin.def wsinh.def \
- wsqrt.def stan.def stanh.def
+chobj = w_acos.def w_acosh.def w_asin.def s_asinh.def \
+ s_atan.def w_atan2.def w_atanh.def w_j0.def \
+ w_cosh.def s_erf.def w_exp.def w_exp2.def \
+ s_fabs.def s_floor.def w_fmod.def s_frexp.def \
+ w_gamma.def w_hypot.def s_ldexp.def w_log.def \
+ w_log10.def \
+ w_pow.def w_remainder.def s_sin.def w_sinh.def \
+ w_sqrt.def s_tan.def s_tanh.def
SUFFIXES = .def
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
@@ -1424,94 +1424,6 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
doc: $(chobj)
cat $(srcdir)/math.tex >> $(TARGETDOC)
-# Texinfo does not appear to support underscores in file names, so we
-# name the .def files without underscores.
-
-wacos.def: w_acos.c
- $(CHEW) < $(srcdir)/w_acos.c >$@ 2>/dev/null
- touch stmp-def
-wacosh.def: w_acosh.c
- $(CHEW) < $(srcdir)/w_acosh.c >$@ 2>/dev/null
- touch stmp-def
-wasin.def: w_asin.c
- $(CHEW) < $(srcdir)/w_asin.c >$@ 2>/dev/null
- touch stmp-def
-sasinh.def: s_asinh.c
- $(CHEW) < $(srcdir)/s_asinh.c >$@ 2>/dev/null
- touch stmp-def
-satan.def: s_atan.c
- $(CHEW) < $(srcdir)/s_atan.c >$@ 2>/dev/null
- touch stmp-def
-watan2.def: w_atan2.c
- $(CHEW) < $(srcdir)/w_atan2.c >$@ 2>/dev/null
- touch stmp-def
-watanh.def: w_atanh.c
- $(CHEW) < $(srcdir)/w_atanh.c >$@ 2>/dev/null
- touch stmp-def
-wj0.def: w_j0.c
- $(CHEW) < $(srcdir)/w_j0.c >$@ 2>/dev/null
- touch stmp-def
-scopysign.def: s_copysign.c
- $(CHEW) < $(srcdir)/../common/s_copysign.c >$@ 2>/dev/null
- touch stmp-def
-wcosh.def: w_cosh.c
- $(CHEW) < $(srcdir)/w_cosh.c >$@ 2>/dev/null
- touch stmp-def
-serf.def: s_erf.c
- $(CHEW) < $(srcdir)/s_erf.c >$@ 2>/dev/null
- touch stmp-def
-wexp.def: w_exp.c
- $(CHEW) < $(srcdir)/w_exp.c >$@ 2>/dev/null
- touch stmp-def
-sfabs.def: s_fabs.c
- $(CHEW) < $(srcdir)/s_fabs.c >$@ 2>/dev/null
- touch stmp-def
-sfloor.def: s_floor.c
- $(CHEW) < $(srcdir)/s_floor.c >$@ 2>/dev/null
- touch stmp-def
-wfmod.def: w_fmod.c
- $(CHEW) < $(srcdir)/w_fmod.c >$@ 2>/dev/null
- touch stmp-def
-sfrexp.def: s_frexp.c
- $(CHEW) < $(srcdir)/s_frexp.c >$@ 2>/dev/null
- touch stmp-def
-wgamma.def: w_gamma.c
- $(CHEW) < $(srcdir)/w_gamma.c >$@ 2>/dev/null
- touch stmp-def
-whypot.def: w_hypot.c
- $(CHEW) < $(srcdir)/w_hypot.c >$@ 2>/dev/null
- touch stmp-def
-sldexp.def: s_ldexp.c
- $(CHEW) < $(srcdir)/s_ldexp.c >$@ 2>/dev/null
- touch stmp-def
-wlog.def: w_log.c
- $(CHEW) < $(srcdir)/w_log.c >$@ 2>/dev/null
- touch stmp-def
-wlog10.def: w_log10.c
- $(CHEW) < $(srcdir)/w_log10.c >$@ 2>/dev/null
- touch stmp-def
-wpow.def: w_pow.c
- $(CHEW) < $(srcdir)/w_pow.c >$@ 2>/dev/null
- touch stmp-def
-wremainder.def: w_remainder.c
- $(CHEW) < $(srcdir)/w_remainder.c >$@ 2>/dev/null
- touch stmp-def
-ssin.def: s_sin.c
- $(CHEW) < $(srcdir)/s_sin.c >$@ 2>/dev/null
- touch stmp-def
-wsinh.def: w_sinh.c
- $(CHEW) < $(srcdir)/w_sinh.c >$@ 2>/dev/null
- touch stmp-def
-wsqrt.def: w_sqrt.c
- $(CHEW) < $(srcdir)/w_sqrt.c >$@ 2>/dev/null
- touch stmp-def
-stan.def: s_tan.c
- $(CHEW) < $(srcdir)/s_tan.c >$@ 2>/dev/null
- touch stmp-def
-stanh.def: s_tanh.c
- $(CHEW) < $(srcdir)/s_tanh.c >$@ 2>/dev/null
- touch stmp-def
-
# A partial dependency list.
$(lib_a_OBJECTS): $(srcdir)/../../libc/include/math.h $(srcdir)/../common/fdlibm.h
diff --git a/newlib/libm/math/math.tex b/newlib/libm/math/math.tex
index 7bc56ce9a..608268ab9 100644
--- a/newlib/libm/math/math.tex
+++ b/newlib/libm/math/math.tex
@@ -9,6 +9,7 @@ Two definitions from @file{math.h} are of particular interest.
@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
@@ -44,43 +45,59 @@ machines---are available when you include @file{fastmath.h} instead of
* atan:: Arctangent
* atan2:: Arctangent of y/x
* atanh:: Inverse hyperbolic tangent
-* jN:: Bessel functions (jN, yN)
+* jN:: Bessel functions (jN, yN)
* cbrt:: Cube root
* copysign:: Sign of Y, magnitude of X
* cosh:: Hyperbolic cosine
-* erf:: Error function (erf, erfc)
-* exp:: Exponential
-* expm1:: Exponential of x, - 1
+* erf:: Error function (erf, erfc)
+* exp:: Exponential, base e
+* exp2:: Exponential, base 2
+* expm1:: Exponential, base e, of x - 1
* fabs:: Absolute value (magnitude)
-* floor:: Floor and ceiling (floor, ceil)
+* fdim:: Positive difference
+* floor:: Floor and ceiling (floor, ceil)
+* fma:: Floating multiply add
+* fmax:: Maximum
+* fmin:: Minimum
* fmod:: Floating-point remainder (modulo)
+* fpclassify:: Floating-point classification macro
* frexp:: Split floating-point number
* gamma:: Logarithmic gamma function
* hypot:: Distance from origin
* ilogb:: Get exponent
* infinity:: Floating infinity
-* isnan:: Check type of number
-* ldexp:: Load exponent
+* isgreater:: Comparison macros
+* ldexp:: Scale by a power of 2
* log:: Natural logarithms
* log10:: Base 10 logarithms
* log1p:: Log of 1 + X
+* log2:: Base 2 logarithms
+* 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
* nextafter:: Get next representable number
* pow:: X to the power Y
* remainder:: remainder of X divided by Y
-* scalbn:: scalbn
+* remquo:: Remainder and part of quotient
+* rint:: Round to integer
+* round:: Round to integer, away from zero
+* scalbn:: Scale by a power of FLT_RADIX (2)
+* signbit:: Does floating-point number have negative sign?
* sin:: Sine or cosine (sin, cos)
* sinh:: Hyperbolic sine
* sqrt:: Positive square root
* tan:: Tangent
* tanh:: Hyperbolic tangent
+* trunc:: Round to integer, towards zero
@end menu
@page
@node version
-@section Version of library
+@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
@@ -114,119 +131,89 @@ log: DOMAIN error
The library is set to X/Open mode by default.
-@page
-@include math/wacos.def
-
-@page
-@include math/wacosh.def
-
-@page
-@include math/wasin.def
-
-@page
-@include math/sasinh.def
-
-@page
-@include math/satan.def
-
-@page
-@include math/watan2.def
-
-@page
-@include math/watanh.def
-
-@page
-@include math/wj0.def
-
-@page
-@include common/scbrt.def
-
-@page
-@include common/scopysign.def
-
-@page
-@include math/wcosh.def
-
-@page
-@include math/serf.def
-
-@page
-@include math/wexp.def
-
-@page
-@include common/sexpm1.def
-
-@page
-@include math/sfabs.def
-
-@page
-@include math/sfloor.def
-
-@page
-@include math/wfmod.def
-
-@page
-@include math/sfrexp.def
-
-@page
-@include math/wgamma.def
-
-@page
-@include math/whypot.def
-
-@page
-@include common/silogb.def
-
-@page
-@include common/sinfinity.def
-
-@page
-@include common/sisnan.def
-
-@page
-@include math/sldexp.def
-
-@page
-@include math/wlog.def
-
-@page
-@include math/wlog10.def
-
-@page
-@include common/slog1p.def
-
-@page
-@include common/smatherr.def
-
-@page
-@include common/smodf.def
-
-@page
-@include common/snan.def
-
-@page
-@include common/snextafter.def
-
-@page
-@include math/wpow.def
-
-@page
-@include math/wremainder.def
-
-@page
-@include common/sscalbn.def
-
-@page
-@include math/wsqrt.def
-
-@page
-@include math/ssin.def
-
-@page
-@include math/wsinh.def
-
-@page
-@include math/stan.def
-
-@page
-@include math/stanh.def
+The aforementioned error reporting is the supported Newlib libm error
+handling method. However, the majority of the 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
+the floating-point exception access routines defined in the standards
+for fenv.h, though, which is why they are considered unsupported. It is
+mentioned in case you have separately-provided access routines so that
+you are aware that they can be caused.
+
+@section Standards Compliance And Portability
+Most of the individual function descriptions describe the standards to which
+each function complies. However, these descriptions are mostly out of date,
+having been written before C99 was released. One of these days we'll get
+around to updating the rest of them. (If you'd like to help, please let us
+know.)
+
+``C99'' refers to ISO/IEC 9899:1999, ``Programming languages--C''.
+``POSIX'' refers to IEEE Standard 1003.1. POSIX@registeredsymbol{} is a
+registered trademark of The IEEE.
+
+@c To sort the include list easily, keep the indentation right because want to
+@c skip the s_|w_ at the start of most--but not all--of the file names.
+@c (e.g., isgreater.def does not have a leading s nor w.) Then, sort
+@c based on the column. For example: "sort -t@ -k3.17"
+@c A few hand-edits might be appropriate after a sort, although not necessary
+@c and are a nuisance as ought to be kept in sync with menu list above:
+@c atan2 after atan, exp2 after exp, log first in log list, and w_j0 to place
+@c to reflect function name of Bessel (as opposed to j; e.g. after atanh,
+@c before cbrt).
+
+@page @include math/w_acos.def
+@page @include math/w_acosh.def
+@page @include math/w_asin.def
+@page @include math/s_asinh.def
+@page @include math/s_atan.def
+@page @include math/w_atan2.def
+@page @include math/w_atanh.def
+@page @include math/w_j0.def
+@page @include common/s_cbrt.def
+@page @include common/s_copysign.def
+@page @include math/w_cosh.def
+@page @include math/s_erf.def
+@page @include math/w_exp.def
+@page @include math/w_exp2.def
+@page @include common/s_expm1.def
+@page @include math/s_fabs.def
+@page @include common/s_fdim.def
+@page @include math/s_floor.def
+@page @include common/s_fma.def
+@page @include common/s_fmax.def
+@page @include common/s_fmin.def
+@page @include math/w_fmod.def
+@page @include math/s_frexp.def
+@page @include math/w_gamma.def
+@page @include math/w_hypot.def
+@page @include common/s_ilogb.def
+@page @include common/s_infinity.def
+@page @include common/isgreater.def
+@page @include common/s_isnan.def
+@page @include math/s_ldexp.def
+@page @include math/w_log.def
+@page @include math/w_log10.def
+@page @include common/s_log1p.def
+@page @include common/s_log2.def
+@page @include common/s_logb.def
+@page @include common/s_lrint.def
+@page @include common/s_lround.def
+@page @include common/s_matherr.def
+@page @include common/s_modf.def
+@page @include common/s_nan.def
+@page @include common/s_nearbyint.def
+@page @include common/s_nextafter.def
+@page @include math/w_pow.def
+@page @include math/w_remainder.def
+@page @include common/s_remquo.def
+@page @include common/s_rint.def
+@page @include common/s_round.def
+@page @include common/s_scalbn.def
+@page @include common/s_signbit.def
+@page @include math/s_sin.def
+@page @include math/w_sinh.def
+@page @include math/w_sqrt.def
+@page @include math/s_tan.def
+@page @include math/s_tanh.def
+@page @include common/s_trunc.def
diff --git a/newlib/libm/math/w_exp2.c b/newlib/libm/math/w_exp2.c
index ed0bc39e9..efb676df1 100644
--- a/newlib/libm/math/w_exp2.c
+++ b/newlib/libm/math/w_exp2.c
@@ -13,7 +13,7 @@
/*
FUNCTION
- <<exp2>>, <<exp2f>>---exponential
+ <<exp2>>, <<exp2f>>--exponential, base 2
INDEX
exp2
INDEX
@@ -24,14 +24,6 @@ ANSI_SYNOPSIS
double exp2(double <[x]>);
float exp2f(float <[x]>);
-TRAD_SYNOPSIS
- #include <math.h>
- double exp2(<[x]>);
- double <[x]>;
-
- float exp2f(<[x]>);
- float <[x]>;
-
DESCRIPTION
<<exp2>> and <<exp2f>> calculate 2 ^ <[x]>, that is,
@ifnottex
@@ -50,6 +42,9 @@ RETURNS
result overflows, the returned value is <<HUGE_VAL>>. In
either case, <<errno>> is set to <<ERANGE>>.
+PORTABILITY
+ ANSI C, POSIX.
+
*/
/*
diff --git a/newlib/libm/math/w_gamma.c b/newlib/libm/math/w_gamma.c
index fad40496d..3717f53e5 100644
--- a/newlib/libm/math/w_gamma.c
+++ b/newlib/libm/math/w_gamma.c
@@ -12,11 +12,20 @@
*
*/
+/* BUG: FIXME?
+ According to Linux man pages for tgamma, lgamma, and gamma, the gamma
+function was originally defined in BSD as implemented here--the log of the gamma
+function. BSD 4.3 changed the name to lgamma, apparently removing gamma. BSD
+4.4 re-introduced the gamma name with the more intuitive, without logarithm,
+plain gamma function. The C99 standard apparently wanted to avoid a problem
+with the poorly-named earlier gamma and used tgamma when adding a plain
+gamma function.
+ So the current gamma is matching an old, bad definition, and not
+matching a newer, better definition. */
/*
FUNCTION
- <<gamma>>, <<gammaf>>, <<lgamma>>, <<lgammaf>>, <<gamma_r>>,
- <<gammaf_r>>, <<lgamma_r>>, <<lgammaf_r>>---logarithmic gamma
- function
+ <<gamma>>, <<gammaf>>, <<lgamma>>, <<lgammaf>>, <<gamma_r>>, <<gammaf_r>>, <<lgamma_r>>, <<lgammaf_r>>, <<tgamma>>, and <<tgammaf>>--logarithmic and plain gamma functions
+
INDEX
gamma
INDEX
@@ -33,6 +42,10 @@ INDEX
lgamma_r
INDEX
lgammaf_r
+INDEX
+tgamma
+INDEX
+tgammaf
ANSI_SYNOPSIS
#include <math.h>
@@ -44,6 +57,8 @@ double gamma_r(double <[x]>, int *<[signgamp]>);
float gammaf_r(float <[x]>, int *<[signgamp]>);
double lgamma_r(double <[x]>, int *<[signgamp]>);
float lgammaf_r(float <[x]>, int *<[signgamp]>);
+double tgamma(double <[x]>);
+float tgammaf(float <[x]>);
TRAD_SYNOPSIS
#include <math.h>
@@ -67,15 +82,19 @@ int <[signgamp]>;
float lgammaf_r(<[x]>, <[signgamp]>)
float <[x]>;
int <[signgamp]>;
+double tgamma(<[x]>)
+double <[x]>;
+float tgammaf(<[x]>)
+float <[x]>;
DESCRIPTION
-<<gamma>> calculates
+<<gamma>> calculates
@tex
-$\mit ln\bigl(\Gamma(x)\bigr)$,
+$\mit ln\bigl(\Gamma(x)\bigr)$,
@end tex
the natural logarithm of the gamma function of <[x]>. The gamma function
(<<exp(gamma(<[x]>))>>) is a generalization of factorial, and retains
-the property that
+the property that
@ifnottex
<<exp(gamma(N))>> is equivalent to <<N*exp(gamma(N-1))>>.
@end ifnottex
@@ -83,13 +102,13 @@ the property that
$\mit \Gamma(N)\equiv N\times\Gamma(N-1)$.
@end tex
Accordingly, the results of the gamma function itself grow very
-quickly. <<gamma>> is defined as
+quickly. <<gamma>> is defined as
@tex
$\mit ln\bigl(\Gamma(x)\bigr)$ rather than simply $\mit \Gamma(x)$
@end tex
@ifnottex
the natural log of the gamma function, rather than the gamma function
-itself,
+itself,
@end ifnottex
to extend the useful range of results representable.
@@ -113,8 +132,17 @@ variable <<signgam>> is not used. These functions may be used for
reentrant calls (but they will still set the global variable <<errno>>
if an error occurs).
+<<tgamma>> and <<tgammaf>> are the "true gamma" functions, returning
+@tex
+$\mit \Gamma(x)$,
+@end tex
+the gamma function of <[x]>--without a logarithm.
+(They are apparently so named because of the prior existence of the old,
+poorly-named <<gamma>> functions which returned the log of gamma up
+through BSD 4.2.)
+
RETURNS
-Normally, the computed result is returned.
+Normally, the computed result is returned.
When <[x]> is a nonpositive integer, <<gamma>> returns <<HUGE_VAL>>
and <<errno>> is set to <<EDOM>>. If the result overflows, <<gamma>>
@@ -123,7 +151,12 @@ returns <<HUGE_VAL>> and <<errno>> is set to <<ERANGE>>.
You can modify this error treatment using <<matherr>>.
PORTABILITY
-Neither <<gamma>> nor <<gammaf>> is ANSI C. */
+Neither <<gamma>> nor <<gammaf>> is ANSI C. It is better not to use either
+of these; use <<lgamma>> or <<tgamma>> instead.@*
+<<lgamma>>, <<lgammaf>>, <<tgamma>>, and <<tgammaf>> are nominally C standard
+in terms of the base return values, although the <<matherr>> error-handling
+is not standard, nor is the <[signgam]> global for <<lgamma>>.
+*/
/* double gamma(double x)
* Return the logarithm of the Gamma function of x.