Pi Approximation Day - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Pi Approximation Day (/thread-15364.html) |
Pi Approximation Day - Gerson W. Barbosa - 07-22-2020 11:22 PM Today is Pi Approximation Day. To celebrate it, here is an HP 50g program based on a variation of the Wallis Product. Here we use (2/1*4/3*6/5*8/7*...) plus a correction factor in continued fraction form. The number of digits per iteration is slightly less than 21/10, which is being used by the program, so this has to be adjusted. The argument of the RPL program is the desired number of decimal places. For n = 100, the program returns 98 correct decimal digits; for n = 200, the program gets all of them right. This takes about one minute on the emulator because of the slowness of EXPAND to process long algebraic expressions. Code:
253 bytes, CKS = # 537h 3,14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745 028410270193852110555964462294895493038196 HP-75C program: Code:
|