|
Message-ID: <20120501183356.GL16237@port70.net> Date: Tue, 1 May 2012 20:33:56 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: math todo * Rich Felker <dalias@...ifal.cx> [2012-05-01 10:44:38 -0400]: > On Tue, May 01, 2012 at 11:14:58AM +0200, Szabolcs Nagy wrote: > > yes, actually > > fesetround(FE_UPWARD); > > exp(-inf) = 0x1p-1074; // smallest subnormal > > instead of 0, which is 1ulp depending on your definition of ulp :) > > This is incorrect (because the result is exact, the error is ==1ulp, > and IEEE requires <1ulp). But for the large finite negative arguments, > 0x1p-1074 is the correctly rounded answer in rounds-upward mode. > ok > > > BTW under asm, we may also want to switch to the faster acos > > > implementation. > > ok i'll add it > > (for double it is known to work, but i havent tested it for > > the long double case) > > Even if we can't switch ld we could still switch it for the > float/double versions and keep our original asm for ld80. > ok > All of the nextafter stuff looks overly complicated. Shouldn't these > functions all just be (essentially): > > if (x>y) rep_x--; > else if (x<y) rep_x++; > > modulo a little handling for sign and ±0? > yes and that's what is done, but under/overflow flags are also handled and for double two uint32_t is used instead of one uint64_t ++ (and comparision is done using int instead of float compare) it can be a bit simpler > > 99 ulp want: 0 got: 8000000000000000 round: m acos arg0: 0x1p+0 arg1: 0x0p+0 want: 0x0p+0 got: -0x0p+0 > > 99 ulp want: 8000000000000000 got: 8000000000000001 round: p atan arg0: -0x1p-1074 arg1: 0x0p+0 want: -0x0p+0 got: -0x1p-1074 > > 99 ulp want: 0 got: 1 round: m atan arg0: 0x1p-1074 arg1: 0x0p+0 want: 0x0p+0 got: 0x1p-1074 > > 99 ulp want: 0 got: 1 round: z atan arg0: 0x1p-1074 arg1: 0x0p+0 want: 0x0p+0 got: 0x1p-1074 > > 99 ulp want: 8000000000000000 got: 8000000000000001 round: z atan arg0: -0x1p-1074 arg1: 0x0p+0 want: -0x0p+0 got: -0x1p-1074 > > IMO this is 1ulp not >99ulp. For denormals ulp is not x * 0x1p-52 but > the actual last place of significance. > yes it is 1ulp, but it's a huge relative error, same for sign differences > > all: 69734 fail: 12787 failbad: 107 failepic: 72 > > Like your choice of naming. :-) :)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.