HP 17B Solver - another ARCTAN(Y/X) approximation
|
05-17-2021, 06:01 PM
(This post was last modified: 05-18-2021 11:15 AM by Albert Chan.)
Post: #7
|
|||
|
|||
RE: HP 17B Solver - another ARCTAN(Y/X) approximation
This version split atan(z) = 3*atan(h) + atan(ε)
At the cost of +-*/ (sum-of-tangents formula), we reduced max rel. error to 5.7e-15 atan(1) = 3*atan(39897/148903) + atan(35024948800/1295182203518473) = 3*atan(0.26793953...) + atan(0.00002704...) Again, we have h ≈ tan(pi/12) = 2 - √3 = 0.26794919... , as expected Note that atan(ε) ≈ ε has errors with opposite sign, cancelled errors of first term estimate. Code: function my_atan2(y, x) Comment: replace coef 15159/35 by 433.1142858 will reduce max. rel. error to 2.0e-15 Note that adjustment is minor, 15159/35 = 433.1(142857) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)