]> sourceware.org Git - newlib-cygwin.git/commit
Fix error in float trig. function range reduction
authorFabian Schriever <fabian.schriever@gtd-gmbh.de>
Tue, 3 Mar 2020 13:49:06 +0000 (14:49 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 3 Mar 2020 15:45:22 +0000 (16:45 +0100)
commitd4bcecb3e91f73091195adbfdcb0d4287cdf1753
tree4beb5627a778633f86804873beeb821307021495
parentecf27dd2e0ed1dff4dc919a7c805e951913d953f
Fix error in float trig. function range reduction

The single-precision trigonometric functions show rather high errors in
specific ranges starting at about 30000 radians. For example the sinf
procedure produces an error of 7626.55 ULP with the input
5.195880078125e+04 (0x474AF6CD) (compared with MPFR in 128bit
precision). For the test we used 100k values evenly spaced in the range
of [30k, 70k]. The issues are periodic at higher ranges.

This error was introduced when the double precision range reduction was
first converted to float. The shift by 8 bits always returns 0 as iq is
never higher than 255.

The fix reduces the error of the example above to 0.45 ULP, highest
error within the test set fell to 1.31 ULP, which is not perfect, but
still a significant improvement. Testing other previously erroneous
ranges no longer show particularly large accuracy errors.
newlib/libm/math/kf_rem_pio2.c
This page took 0.033762 seconds and 5 git commands to generate.