* manual/math.texi (Errors in Math Functions): New section.
	* math/libm-err-tab.pl: Moved to...
	* manual/libm-err-tab.pl: ...here.
	* manual/Makefile: Add rules for math function error table generation.
This commit is contained in:
Ulrich Drepper 1999-10-30 06:56:10 +00:00
parent 6491b8094e
commit aaa1276ee3
4 changed files with 59 additions and 2 deletions

View File

@ -1,5 +1,10 @@
1999-10-29 Ulrich Drepper <drepper@cygnus.com>
* manual/math.texi (Errors in Math Functions): New section.
* math/libm-err-tab.pl: Moved to...
* manual/libm-err-tab.pl: ...here.
* manual/Makefile: Add rules for math function error table generation.
* stdlib/tst-strtod.c: Add more hexadecimal tests.
* stdlib/strtod.c: Handle hexadecimal numbers with leading digit

View File

@ -69,7 +69,7 @@ examples = $(filter-out $(foreach d, $(add-ons), ../$d/%.c.texi), \
chapters.% top-menu.%: libc-texinfo.sh $(texis)
AWK=$(AWK) $(SHELL) $< '$(chapters)' '$(add-chapters)' '$(appendices)'
libc.dvi libc.info: chapters.texi top-menu.texi
libc.dvi libc.info: chapters.texi top-menu.texi libm-err.texi
libc.dvi: texinfo.tex
# Generate the summary from the Texinfo source files for each chapter.
@ -89,6 +89,15 @@ dir-add.info: xtract-typefun.awk $(texis)
echo "END-INFO-DIR-ENTRY") > $@.new
mv -f $@.new $@
# The table with the math errors is generated.
libm-err.texi: stamp-libm-err
stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
$(dir)/libm-test-ulps))
pwd=`pwd`; \
$(PERL) $< $$pwd/.. > libm-err-tmp
$(move-if-change) libm-err-tmp libm-err.texi
touch $@
# Generate Texinfo files from the C source for the example programs.
%.c.texi: examples/%.c
sed -e 's,[{}],@&,g' \
@ -106,13 +115,14 @@ dir-add.info: xtract-typefun.awk $(texis)
# Distribution.
minimal-dist = summary.awk texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
libm-err.texi stamp-libm-err \
$(filter-out summary.texi, $(nonexamples)) \
$(patsubst %.c.texi,examples/%.c, $(examples))
doc-only-dist = Makefile COPYING.LIB
distribute = $(minimal-dist) $(examples) stdio-fp.c \
libc.info* libc.?? libc.??s texinfo.tex \
xtract-typefun.awk dir-add.info dir
xtract-typefun.awk dir-add.info dir libm-err-tab.pl
export distribute := $(distribute)
tar-it = tar chovf $@ $^

View File

@ -61,6 +61,7 @@ same as @code{double}.
* Exponents and Logarithms:: Also pow and sqrt.
* Hyperbolic Functions:: sinh, cosh, tanh, etc.
* Special Functions:: Bessel, gamma, erf.
* Errors in Math Functions:: Known Maximum Errors in Math Functions.
* Pseudo-Random Numbers:: Functions for generating pseudo-random
numbers.
* FP Function Optimizations:: Fast code or small code.
@ -1203,6 +1204,47 @@ is negative, @code{yn} signals a domain error; if it is zero,
@code{yn} signals overflow and returns @math{-@infinity}.
@end deftypefun
@node Errors in Math Functions
@section Known Maximum Errors in Math Functions
@cindex math errors
@cindex ulps
This section lists the known errors of the functions in the math
library. Errors are measured in ``units of the last place''. This is a
measure for the relative error. For a number @math{z} with the
representation @math{d.d@dots{}d@mul{}2^e} (we assume IEEE
floating-point numbers with base 2) the ULP is represented by
@tex
$$\frac{|{\mathrm d.d\dots d - (z/2^e)|}{2^{p-1}}$$
@end tex
@ifnottex
@smallexample
|d.d...d - (z / 2^e)| / 2^(p - 1)
@end smallexample
@end ifnottex
@noindent
where @math{p} is the number of bits in the mantissa of the
floating-point number representation. Ideally the error for all
functions is always less than 0.5ulps. Using rounding bits this is also
possible and normally implemented for the basic operations. To achieve
the same for the complex math functions requires a lot more work and
this was not spend so far.
Therefore many of the functions in the math library have errors. The
table lists the maximum error for each function which is exposed by one
of the existing tests in the test suite. It is tried to cover as much
as possible and really list the maximum error (or at least a ballpark
figure) but this is often not achieved due to the large search space.
The table lists the ULP values for different architectures. Different
architectures have different results since their hardware support for
floating-point operations varies and also the existing hardware support
is different.
@include libm-err.texi
@node Pseudo-Random Numbers
@section Pseudo-Random Numbers
@cindex random numbers