Little explorations with HP calculators (no Prime)
|
11-05-2017, 10:28 PM
(This post was last modified: 11-05-2017 10:29 PM by Joe Horn.)
Post: #248
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
(11-05-2017 04:05 PM)pier4r Wrote: I am slowly continuing to explore the "integer numerator ranges that enclose pi" ... Although the following does not "optimize" your code per se, but rather replaces its algorithm with a much faster one, it still might be of some interest to you. Given any decimal fraction in level 2, and a maximum denominator in level 1, it returns the best fraction, much faster than the brute-force search method. Example: pi, 1000, DEC2FRAC --> 355/113 in 0.39 seconds pi, 100000, DEC2FRAC --> 312689/99532 in 0.43 seconds This program is a slight modification of a program on HP48 Goodies Disk #3. Everything after each "@" is a comment. Code: %%HP:T(3); HP 50g BYTES: 298.5 #ED4h <0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)