]> sourceware.org Git - newlib-cygwin.git/commit
powf: Fixed another precision bug in powf() (FreeBSD) main master github/main github/master
authorFabian Schriever <fabian.schriever@gtd-gmbh.de>
Wed, 11 Sep 2024 14:06:46 +0000 (16:06 +0200)
committerJeff Johnston <jjohnstn@redhat.com>
Thu, 19 Sep 2024 17:58:50 +0000 (13:58 -0400)
commit1b7c72fdcc4bde7520407d2d3364146f04fb8312
tree8a69a234899decb066d8aa037b4a551c2674805f
parentfb7669774552cb09eeb5f226c2c4877fcbdfb046
powf: Fixed another precision bug in powf() (FreeBSD)

Fixed another precision bug in powf(). This one is in the computation
[t=p_l+p_h High]. We multiply t by lg2_h, and want the result to be
exact. For the bogus float case of the high-low decomposition trick, we
normally discard the lowest 12 bits of the fraction for the high part,
keeping 12 bits of precision. That was used for t here, but it doesnt't
work because for some reason we only discard the lowest 9 bits in the
fraction for lg2_h.  Discard another 3 bits of the fraction for t to
compensate.

This bug gave wrong results like:

powf(0.9999999, -2.9999995) = 1.0000002 (should be 1.0000001)
hex values: 3F7FFFFF C03FFFFE 3F800002 3F800001

As explained in the log for the previous commit, the bug is normally
masked by doing float calculations in extra precision on i386's, but is
easily detected by ucbtest on systems that don't have accidental extra
precision.

Reference: https://github.com/freebsd/freebsd-src/commit/5f20e5ce7f396ad064bfc1f45b8075ea1c0580f9
Original Author: Bruce Evans
newlib/libm/math/ef_pow.c
This page took 0.029434 seconds and 5 git commands to generate.