Date: Fri, 30 Dec 2005 11:07:40 -0800 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Peter Jeremy <PeterJeremy@optushome.com.au> Cc: freebsd-hackers@freebsd.org Subject: Re: Implementations of sqrtl and logl Message-ID: <20051230190740.GA10957@troutmask.apl.washington.edu> In-Reply-To: <20051230182611.GD36631@cirb503493.alcatel.com.au> References: <20051229224626.GA4823@troutmask.apl.washington.edu> <20051230182611.GD36631@cirb503493.alcatel.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 31, 2005 at 05:26:12AM +1100, Peter Jeremy wrote: > On Thu, 2005-Dec-29 14:46:26 -0800, Steve Kargl wrote: > >I have implementations for sqrtl and logl, which can be added > >to libm. In limited testing on AMD64 , I find > > > >troutmask:kargl[208] ./test_sqrt > > float double long double > >MRE: 8.953800e-08 1.664855e-16 1.084202e-19 > >DDP: 7.05 15.78 18.96 > >BDP: 23.41 52.42 63.00 > ... > >MRE = maximum relative error between a value from my routine and > > a value computed using GMP/MPFR with 64-bits of precision. > > Given that long double has 64 bits of precision, is testing it against > a 64-bit test library adequate? And what is the accuracy of your test > library? > MPFR uses GMP for its internals. I set MPFR to use 64-bit precision and round-to-nearest. It is claimed that mpfr will give correctly rounded FP values in the requested precision and rounding mode. I can set MPFR to any precision and one of four rounding modes; however, the runtime of the tests will go up. I've changed my test program to use 128 bit precision. Here are the results troutmask:kargl[211] ./test_sqrt 100000000 float double long double MRE: 8.953800e-08 1.664855e-16 1.084202e-19 DDP: 7.05 15.78 18.96 BDP: 23.41 52.42 63.00 MRE: 1.084202e-19 DDP: 18.96 BDP: 63.00 To gather the stats, I need to either convert my long double result into a mpfr_t value or convert the MPFR sqrt value into a long double. I've chosen the latter. Thus, the 128-bit MPFR value is correctly rounded to a 64-bit long double. I don't understand your second question. Are you referring to MPFR?. epsilon is 2**(1 - p) where p is the precision. -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051230190740.GA10957>