]> sourceware.org Git - newlib-cygwin.git/commit
Fix error in exp in magnitude [2e-32,2e-28]
authorFabian Schriever <fabian.schriever@gtd-gmbh.de>
Fri, 6 Mar 2020 14:46:33 +0000 (15:46 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 9 Mar 2020 09:12:25 +0000 (10:12 +0100)
commita8a40ee5750cb8a4280379a38c1ed490262481c4
tree7511e09db050e03fe13331eb407139ef40b11c95
parent3e7fff6b49fbdc1ab5022b145268622d8e5dedd3
Fix error in exp in magnitude [2e-32,2e-28]

While testing the exp function we noticed some errors at the specified
magnitude. Within this range the exp function returns the input value +1
as an output. We chose to run a test of 1m exponentially spaced values
in the ranges [-2^-27,-2^-32] and [2^-32,2^-27] which showed 7603 and
3912 results with an error of >=0.5 ULP (compared with MPFR in 128 bit)
with the highest being 0.56 ULP and 0.53 ULP.

It's easy to fix by changing the magnitude at which the input value +1
is returned from <2^-28 to <2^-32 and using the polynomial instead. This
reduces the number of results with an error of >=0.5 ULP to 485 and 479
in above tests, all of which are exactly 0.5 ULP.

As we were already checking on exp we also took a look at expf. For expf
the magnitude where the input value +1 is returned can be increased from
<2^-28 to <2^-23 without accuracy loss for a slight performance
improvement. To ensure this was the correct value we tested all values
in the ranges [-2^-17,-2^-28] and [2^-28,2^-17] (~92.3m values each).
newlib/libm/math/e_exp.c
newlib/libm/math/ef_exp.c
This page took 0.033189 seconds and 5 git commands to generate.