Click here to Skip to main content
15,886,258 members

Comments by Andy Allinger (Top 4 by date)

Andy Allinger 3-Jun-19 3:41am View    
Deleted
Could you please explain what your script does for those us who don't know ksh?
Andy Allinger 25-Apr-17 1:17am View    
My apologies. Changed program to DOUBLE PRECISION for 64-bit math. It turns out that your answer for .00205501 was better, and that the Pi approximations were wrong too.

with 1 digits, approx of pi is 3 1/7
with 2 digits, approx of pi is 3 14/99
with 3 digits, approx of pi is 3 16/113
with 4 digits, approx of pi is 3 16/113
with 5 digits, approx of pi is 3 14093/99532
with 6 digits, approx of pi is 3 140914/995207
with 7 digits, approx of pi is 3 244252/1725033
DF2F(.00205501D0, 6): 1829/890020

Why did I ever doubt the mathematicians?

Andy Allinger 23-Apr-17 22:35pm View    
3.1415927 is as close as possible in 32-bit math.
Andy Allinger 23-Apr-17 20:56pm View    
The Farey tree gives the answer to a subtly different question: find the smallest fraction to approximate within a given tolerance. Brute force will find the best approximation, up to machine precision