Calculating e^x1 on classic HPs

02042019, 07:59 PM
Post: #41




RE: Calculating e^x1 on classic HPs  
02262021, 03:00 PM
(This post was last modified: 02282021 08:42 PM by Albert Chan.)
Post: #42




RE: Calculating e^x1 on classic HPs
(01142016 09:22 PM)Paul Dale Wrote: Definitely Kahan's method not mine. I can't find a working link to it Kahan's article, How Java’s FloatingPoint Hurts Everyone Everywhere mentioned expm1(x), although not directly. JAVAhurt.pdf, page 29, estimate of A(X):=(X1)/(e^(X1)1) Wrote:Real Function Â( Real X ) ; Let x = X1. For Z = e^x ≠ 1, we have: A(X) = x / expm1(x) ≈ ln(Z) / (Z1) → expm1(x) ≈ (Z1)/ln(Z) * x Update: I found another expm1(x) formula derivation, with explanation. How Futile are Mindless Assessments of Roundoff in FloatingPoint Computation ? page 19, T(z) = expm1(z) / z ≈ (e^z1)/ln(e^z) Relative Error of numerator and denominator have same sign, almost cancelled out. T(x+ε) ≈ (e^(x+ε)1)/ln(e^(x+ε)) ≈ (e^x*(1+ε)1) / (x+ε) T(x+ε)/T(x) ≈ (1 + ε/(1e^x)) / (1 + ε/x) ≈ 1 + (ε/(1e^x)  ε/x) If we use e^x ≈ 1x, relative error term totally cancelled. Add 1 more term, using e^x ≈ 1x+x²/2, we have: T(x+ε)/T(x)  1 ≈ ε/(2x) ≈ ε/2, for small x 

03012021, 02:23 PM
Post: #43




RE: Calculating e^x1 on classic HPs
(02262021 03:00 PM)Albert Chan Wrote: Let x = X1. For Z = e^x ≠ 1, we have: Kahan's expm1 formula is good, but we can make it better. Let h = x  ln(Z), rewrite it as corrections to Z1: expm1(x) ≈ (Z1) + (Z1)/(xh) * h ≈ (Z1) + √Z * h, when x is tiny √Z version avoided testing dividebyzero, when (Z1)/ln(Z) = 0/0 = ? Compare this against Dieter's version: expm1(x) ≈ (Z1) + Z * h Statistically, both versions seems to be equally good. This may be why. For small x, Z ≈ 1+x, √Z ≈ 1+x/2: Difference between two version is x*(h/2), correction too small to affect result. 

« Next Oldest  Next Newest »

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