During my primary education, the number 22/7 surfaced frequently. In absence of a calculator or decent memory, we were told to use 22/7 as an approximation for pi. While moderately useful in simple geometric calculations, 22/7 is only accurate to two decimal places. This frustrated the hell out of me, and so, instead of listening to the teacher like i should've, i spent an entire mathematics class looking for a better rational approximation of pi. Admittedly, the method I used as a ten year-old was a tad rudimentary. I think i had just reached triple digits before giving up.

Flash forward 8 years and I finally bothered to code a c program for determining rational approximations of floats.


pi
22 / 7         (2)*
355 / 113      (6)
86953 / 27678  (7)

e
19 / 7         (2)
87 / 32        (3)
878 / 323      (4)

sqrt(2)
99 / 70        (4)
577 / 408      (5)
8119 / 5741    (7)

* decimal places correct

Log in or registerto write something here or to contact authors.