Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant
|
02-18-2017, 12:53 AM
Post: #18
|
|||
|
|||
RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant
(02-16-2017 08:29 PM)Gerson W. Barbosa Wrote: 7 RFC --> 3.23525641025 Many of the programs submitted in this thread suffer from avoidable roundoff error due to summing the reciprocals starting with the largest and ending with the smallest, which is always a Bad Thing to do. For example, the above value is incorrect (the last digit should be 6), but if the reciprocals are summed in the opposite order, beginning with 1/F(7) and ending with 1/F(1), then the correct result is obtained. In general, the following RFC(n) when obtained by summing 1/F(1) through 1/F(n) are incorrect (in a 12-digit mantissa machine), but when obtained by summing 1/F(n) through 1/F(1) they are correct (rounded to 12 significant digits of course): RFC 7; 8; 13-24; 27-29; 31-36; and all n>=38. Both summation orders fail only for RFC 25 & 37; higher precision methods are required for those two values of n. For reference, here are their correct rounded values: RFC(25) = 3.35986409965 RFC(37) = 3.35988559927 <0|ɸ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)