Post Reply 
A (quite) accurate ln1+x function, or "how close can you get" part II
04-11-2014, 07:01 PM
Post: #3
RE: A (quite) accurate ln1+x function, or "how close can you get" part II
Thank you very much for your reply.

(04-10-2014 04:47 AM)htom trites Wrote:  For a and a+ULP, is (f(a+ULP) - f(a)) positive, zero, or negative. Hopefully they'd all be positive

I assume you mean: "in this case", i.e. for f(x) = ln(1+x).

(04-10-2014 04:47 AM)htom trites Wrote:  but it can happen that there's a place where you get a string of zeros where f(a) is changing much slower than a. You shouldn't ever find a negative.

In a monotonically increasing function, yes.

Hm, what about a test with a milliion random numbers? I did one just out of curiosity. There were no negatives.

(04-10-2014 04:47 AM)htom trites Wrote:  The value of the error of a-inverse(function(a)) and a-function(inverse(a)) would ideally be always zero, of course, but unless both the function and the inverse are absolutely monotonic that won't happen.

I won't happen either in real life calculators with limited accuracy. ;-)

Consider for instance sqrt(x) and its inverse x² with, say, 10 digits:

1,414213562 < sqrt(2) < 1,414213563
1,414213562² = 1,999999998
1,414213563² = 2,000000001

So a – inverse(function(a)) is either 2 ULP low or 1 ULP high, although both f(a) and its inverse are strictly monotonic.

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.

Dieter
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 - Dieter - 04-11-2014 07:01 PM



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