Post Reply 
A (quite) accurate ln1+x function, or "how close can you get" part II
01-31-2019, 07:04 PM (This post was last modified: 02-01-2019 01:30 PM by Albert Chan.)
Post: #4
RE: A (quite) accurate ln1+x function, or "how close can you get" part II
(04-11-2014 07:01 PM)Dieter Wrote:  I did some more tests of the ln1+x approximation suggested above. There is one weak point for negative x between –9,5 · 10n and –10n–1, where n is the working precision (number of significant digits). Here the suggested approximation is typically 5 ULP off, so in this small interval it's not better than the original HP/Kahan method. Otherwise it seems to work fine.

Excess ULP error is due to correction *lowering* decimal exponent.
It does not limited to the edge of working precision. (note: above exponents had the sign wrong)

Example, crossing -0.001 boundary:

-0.001 = LN(1 - 0.0009995001666 ...), so try around the edge, say X = -0.00099950016

LN(1+X) = LN( 0.9990004998 ) = -1.000000033e-3 (error ~ 0.4 ulp)

correction = -(X+1-1-X) / (1+X) = +4.004002001e-11 (all digits correct)

log1p(X) ~ LN(1+X) + correction = -9.9999999930e-4 (error = 4 ULP, exponent down 1)

Actual error, either absolute (4e-13) or relative (4e-10) are not affected.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: A (quite) accurate ln1+x function, or "how close can you get" part II - Albert Chan - 01-31-2019 07:04 PM



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