Post Reply 
Prime calculator sum(1.0002^n/n, 1, 20000)
12-29-2020, 05:10 PM
Post: #24
RE: Prime calculator sum(1.0002^n/n, 1, 20000)
(12-29-2020 01:57 AM)Gil Wrote:  Just note that, due to roundings, the last digits of the
given result 28.14397383505516924725756564071173
are — not surprisingly — incorrect after checking with Wolfram Alpha
(458 [55], instead of 173).

The errors mostly comes from implementation of Y^X.
For integer X, Free42 were patched to repeated squaring: Y^X = (Y^(X//2))^2 * Y^(X%2)

Example, for 7 squarings:
1.0002 128 Y^X               → 1.025927868161809572716800732564789
1.0002 LN 128 × E^X       → 1.025927868161809572716800732564790

Extending to 14 squarings:
1.0002 16384 Y^X           → 26.48218820206050462500040752260032
1.0002 LN 16384 × E^X   → 26.48218820206050462500040752260470 (last digit should be 1)

Because all terms are using the same base, almost all errors fall on the same side.
And, it get worse and worse, with 1 ULP error for 7 squarings to 471-32 = 439 ULP for 14.

I replaced Y^X by E^(X*LN(Y)), and the sum ends in 447, much closer to true result.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Prime calculator sum(1.0002^n/n, 1, 20000) - Albert Chan - 12-29-2020 05:10 PM



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