# TITLE: Approximate Fraction # AUTHOR: Karl Ove Hufthammer, huftis@bigfoot.com # (this version modified by Roy F.A. Maclean) # EMAIL: rfamgm at gmail # WEB: http://www.spiderpixel.co.uk/caspro # DATE: 17Sep1999, 13Jan2000 # MAKE: CASIO # MODEL: Any # NOTES: # # Just type in a number, and press EXE until you get a accurate enough # fraction. You can even get good a approximation for pi! # The program displays the numerator (stored in U), the denominator # (stored in V), and the difference between this fraction and # the original number. @@ Program "APPFRAC" "N"?->A~B 1->R Lbl 1 10A->A 10R->R Frac A<>0=>Goto 1 1->S~Y 0->T~X Lbl 2 A->M:R->A Int (M/A->Q M-QA->R QY+T->U QX+S->V U/V->Z B-Z->C "NUM":U_ "DEN":V_ "DIFF":Abs C_ Y->T:U->Y X->S:V->X C<>0=>Goto 2 "NUM":U_ "DEN":V_ "END"