Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2005 14:46:26 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Implementations of sqrtl and logl
Message-ID:  <20051229224626.GA4823@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help
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: 1.084202e-19
DDP: 18.96
BDP: 63.00

troutmask:kargl[210] ./test_log
     float         double        long double
MRE: 2.934316e-07  4.743044e-16  2.418119e-19
DDP: 6.53          15.32         18.62
BDP: 21.70         50.91         61.84

MRE: 1.777483e-19
DDP: 18.75
BDP: 62.29

MRE = maximum relative error between a value from my routine and
      a value computed using GMP/MPFR with 64-bits of precision.
DDP = decimal digits of precision = - log10(MRE)
BDP = binary digits of precision  = - log2(MRE)

In the first set of numbers for each test, I have exhaustively
scanned the entire range of float values.  In these tests, I 
have also implemented float and double routines as a sanity
check on the algorithms used for long double.  The second 
second of numbers are obtained from ten million values over the
entire range of long double where these values are drawn from
/dev/random.

One may infer from the numbers above that sqrtl has <1/2 ULP and
logl has about 1.2 ULP.  It should be noted that the above assumes
round-to-nearest FP, which is the default rounding mode for libm.
I have not tested the other rounding modes.

There is some minor cleanup I need to do in the code before
its ready for inclusion in lib/msun.  Namely, I've done my hacking
outside of the lib/msun hierarchy, so I need to update Makefiles
and the mapages.

-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051229224626.GA4823>