Accuracy of HP Financial Calculators - Canadian mortgage
|
04-08-2014, 08:19 PM
(This post was last modified: 04-09-2014 12:19 PM by Dieter.)
Post: #21
|
|||
|
|||
RE: Accuracy of HP Financial Calculators - Canadian mortgage
(04-07-2014 11:16 PM)Thomas Klemm Wrote: But it's still good to know when you better avoid it. OK, you could check whether (1+x) – 1 equals x and then evaluate ln(1+x) literally (1 + LN). But is it worth the effort? Without a dedicated function the last digit cannot be trusted anyway. (04-07-2014 11:16 PM)Thomas Klemm Wrote: OTOH: how does your method compare to HP's trick to calculate \(log(1+x)\) for small values? The artanh-method was not intended to replace HP's method. It's an alternative way that requires only two stack levels. But anyway I did a quick test. I used the 34s emulator with a short program that rounds every intermediate result to a given number of significant digits and compares the approximate result with that of the the exact ln1+x function. This was done for 100.000 random numbers between 1 and 1E-15, using x = 10^(–15 · ran#). The seed for the RNG was always the same. Here are the results: 10 digit working precision: HP method: error within –6 ... +9 ULP artanh method: error within –6 ... +6 ULP 12 digit working precision: HP method: error within –6 ... +9 ULP artanh method: error within –7 ... +8 ULP 16 digit working precision: HP method: error within –5 ... +8 ULP artanh method: error within –4 ... +4 ULP So the artanh method seems to perform on par or even slightly better. On the other hand the HP method also works for large x where the artanh method fails (argument rounds to 1). Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 14 Guest(s)