From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
To: "Keith Packard" <keithp@keithp.com>
Cc: newlib@sourceware.org
Subject: Re: issue with tgammaf
Date: Wed, 13 Jan 2021 06:46:49 +0100 [thread overview]
Message-ID: <mwturlmlrq.fsf@tomate.loria.fr> (raw)
In-Reply-To: <878sd8e62g.fsf@keithp.com>
Dear Keith,
> Do you know that newlib has two different sets of 32-bit math functions?
> Arm supplied a new set of many common math functions that use 64-bit
> doubles for the intermediate computations? I'd be very interested in
> measuring the effect of that code on accuracy. The new paths are
> selected by compiling newlib with -D__OBSOLETE_MATH_DEFAULT=0 while the
> old can be selected with -D__OBSOLETE_MATH_DEFAULT=1
here are the differences. For each function, the first line is newlib-4.1.0
with default configuration, the second line is newlib-4.1.0 with
-D__OBSOLETE_MATH_DEFAULT=1. Functions that do not appear (like acos) give
the same results in both cases (thus probably there is no new code).
For each line, "errors" is the number of binary32 inputs that are incorrectly
rounded, "errors2" is the number of inputs with an error >= 2 ulps, and "maxerr"
is the maximal error.
In summary, the old code (__OBSOLETE_MATH_DEFAULT=1) is always better in terms
of accuracy, with huge differences for some functions (cos, exp, exp10, exp2,
log, log2, sin, pow).
For bivariate functions (atan2, hypot, pow), the tests are not exhaustive.
Best regards,
Paul
acosh:
Total: errors=244658623 (5.72%) errors2=2698 maxerr=2.01e+00 ulp(s)
Total: errors=243413455 (5.69%) errors2=2698 maxerr=2.01e+00 ulp(s)
asinh:
Total: errors=542122908 (12.67%) errors2=2748 maxerr=1.78e+00 ulp(s)
Total: errors=539621602 (12.61%) errors2=2748 maxerr=1.78e+00 ulp(s)
cos:
Total: errors=209833072 (4.90%) errors2=6 maxerr=2.91e+00 ulp(s)
Total: errors=28209648 (0.66%) errors2=0 maxerr=7.76e-01 ulp(s)
cosh:
Total: errors=23905668 (0.56%) errors2=7706 maxerr=2.51e+00 ulp(s)
Total: errors=17868390 (0.42%) errors2=3558 maxerr=1.89e+00 ulp(s)
erf:
Total: errors=126741900 (2.96%) errors2=0 maxerr=9.68e-01 ulp(s)
Total: errors=126734730 (2.96%) errors2=0 maxerr=9.68e-01 ulp(s)
erfc:
Total: errors=21247299 (0.50%) errors2=1131209 maxerr=6.39e+01 ulp(s)
Total: errors=20982747 (0.49%) errors2=1067774 maxerr=6.39e+01 ulp(s)
exp:
Total: errors=17982847 (0.42%) errors2=0 maxerr=9.11e-01 ulp(s)
Total: errors=170646 (0.00%) errors2=0 maxerr=5.02e-01 ulp(s)
exp10:
Total: errors=18423203 (0.43%) errors2=0 maxerr=1.06e+00 ulp(s)
Total: errors=172143 (0.00%) errors2=0 maxerr=5.03e-01 ulp(s)
exp2:
Total: errors=18401203 (0.43%) errors2=0 maxerr=1.02e+00 ulp(s)
Total: errors=168362 (0.00%) errors2=0 maxerr=5.02e-01 ulp(s)
j0:
Total: errors=1338235574 (31.28%) errors2=279528826 maxerr=6.18e+06 ulp(s)
Total: errors=1334176546 (31.19%) errors2=269351612 maxerr=6.18e+06 ulp(s)
j1:
Total: errors=1818091384 (42.50%) errors2=1376362116 maxerr=1.68e+07 ulp(s)
Total: errors=1816660580 (42.46%) errors2=1373004084 maxerr=1.68e+07 ulp(s)
lgamma:
Total: errors=510903809 (11.94%) errors2=13277834 maxerr=7.50e+06 ulp(s)
Total: errors=506865167 (11.85%) errors2=13400241 maxerr=7.50e+06 ulp(s)
log:
Total: errors=13363494 (0.31%) errors2=0 maxerr=8.88e-01 ulp(s)
Total: errors=416908 (0.01%) errors2=0 maxerr=8.18e-01 ulp(s)
log10:
Total: errors=30061115 (0.70%) errors2=91958 maxerr=2.10e+00 ulp(s)
Total: errors=29787060 (0.70%) errors2=62225 maxerr=2.07e+00 ulp(s)
log2:
Total: errors=602745869 (14.09%) errors2=258 maxerr=1.65e+00 ulp(s)
Total: errors=313550 (0.01%) errors2=0 maxerr=7.52e-01 ulp(s)
sin:
Total: errors=206155238 (4.82%) errors2=0 maxerr=1.37e+00 ulp(s)
Total: errors=29362804 (0.69%) errors2=0 maxerr=5.61e-01 ulp(s)
sinh:
Total: errors=74587762 (1.74%) errors2=38924 maxerr=2.51e+00 ulp(s)
Total: errors=71328304 (1.67%) errors2=34776 maxerr=1.89e+00 ulp(s)
tgamma:
Total: errors=2028164922 (47.41%) errors2=1833526367 maxerr=2.39e+02 ulp(s)
Total: errors=2026865970 (47.38%) errors2=1832940352 maxerr=2.39e+02 ulp(s)
y0:
Total: errors=1306144386 (30.53%) errors2=191859954 maxerr=4.84e+06 ulp(s)
Total: errors=1304302538 (30.49%) errors2=187031173 maxerr=4.84e+06 ulp(s)
y1:
Total: errors=1201178797 (28.08%) errors2=153321647 maxerr=6.18e+06 ulp(s)
Total: errors=1199229206 (28.03%) errors2=148430893 maxerr=6.18e+06 ulp(s)
pow:
pow 0 -1 0x1.d55902p-1,-0x1.fe037ep+9 [1.69e+02] 168.527 168.5268728137016
pow 0 -1 0x1.025736p+0,0x1.309f94p+13 [0.817] 0.816736 0.816736102104187
next prev parent reply other threads:[~2021-01-13 5:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 8:21 Paul Zimmermann
2020-09-15 17:28 ` Keith Packard
2020-09-16 8:33 ` Paul Zimmermann
2020-09-16 15:13 ` Keith Packard
2020-09-17 7:18 ` Paul Zimmermann
2020-09-17 16:11 ` Keith Packard
2021-01-13 5:46 ` Paul Zimmermann [this message]
2021-01-13 6:38 ` Keith Packard
2021-01-13 7:52 ` Paul Zimmermann
2020-09-18 21:21 ` Jeff Johnston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mwturlmlrq.fsf@tomate.loria.fr \
--to=paul.zimmermann@inria.fr \
--cc=keithp@keithp.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).