Post Reply 
(Free42) accuracy of LN1+X
06-14-2020, 12:48 PM
Post: #9
RE: (Free42) accuracy of LN1+X
(06-14-2020 01:09 AM)Paul Dale Wrote:  This function is actually fairly easy to implement once its problems are realised.

Probably not.

decimal128 unable to round-trip thru binary128 occurs at all ranges, not just tiny x
We just don't noticed it when x is bigger ...

For example, try this:

1e-12 XEQ "LN1+X"     → 9.999999999995000000000003333333334e-13

We expected result should be rounded(x - x²/2 + x³/3), with last digit = 3

x = 1e-12 converted to binary128, we got x' ≈ (10^33+0.08)/10^45, over-estimated 0.45 ULP

log1p(x') ≈ 9.99999999999500000000000333333333413e-13

This example is lucky that roundings compensated the x'-x error.
You can potientially get into double-rounding errors, all on the same side.

However, even if conversion is exact, we still cannot get correctly rounded result.

>>> from gmpy2 import *
>>> get_context().precision = 113 # binary128
>>> y = log1p(mpfr('1e-12'))
>>> format(y, '.33e')
'9.999999999995000000000003333333334e-13'
>>> format(next_below(y), '.33e')
'9.999999999995000000000003333333332e-13'
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(Free42) accuracy of LN1+X - Werner - 06-12-2020, 03:23 PM
RE: (Free42) accuracy of LN1+X - grsbanks - 06-12-2020, 08:21 PM
RE: (Free42) accuracy of LN1+X - ijabbott - 06-13-2020, 11:07 AM
RE: (Free42) accuracy of LN1+X - johanw - 06-12-2020, 10:07 PM
RE: (Free42) accuracy of LN1+X - rprosperi - 06-12-2020, 10:45 PM
RE: (Free42) accuracy of LN1+X - Paul Dale - 06-14-2020, 01:09 AM
RE: (Free42) accuracy of LN1+X - Albert Chan - 06-14-2020 12:48 PM
RE: (Free42) accuracy of LN1+X - Paul Dale - 06-14-2020, 10:39 PM



User(s) browsing this thread: 1 Guest(s)