Program to replace ->FRAC


[Prev][Next][Index][Thread]

Program to replace ->FRAC



There has been some discussion in the past about the limitations
of the ->FRAC command on the TI-8x calculators.  The main gripe
about the command is that it limits denominators to a maximum
of four digits.

This program, N2FRAC, overcomes the four digit limitation but
does have limits of its own.  It's limit is a 10 digit numerator
or denominator.  Beyond 10 digits the number gets converted over
to scientific notation.  Because of this limitation the calculated
fraction may only be a close approximation.  If time permits an
algorithm will be written to overcome the 10 digit limitation.

N2FRAC will convert the number stored in the system variable Ans.
The output is three numbers.  The first number is the numerator,
the second is the denominator, and the third is the calculated
decimal value of the  fraction.  The third number was included
only to compare the original decimal value with that of the
fraction.

The program is written for the TI-83 but can easily be typed in any of
the TI-8x calcs.

If you have any problems with this program or if you find a number
it will not convert (within the 10 digit limit) please contact me
at either:
rhomard@juno.com   or   rcriasm@dwx.com

Enjoy.

Rick Homard

\start83\
\comment=Program file dated 06/26/97, 16:27
\name=N2FRAC
\file=
Ans\->\X
1\->\dim(L\1\
1\->\J
iPart(X\->\L\1\(J
fPart(X\->\X
While (round(X,9)\!=\0) and (J<16
J+1\->\J
X\^-1\\->\X
iPart(X\->\L\1\(J
fPart(X\->\X
End

L\1\(J\->\A
1\->\B
L\1\(J-1)A+B\->\C
A\->\B
C\->\A
For(K,J-2,1,\(-)\1
L\1\(K)A+B\->\C
A\->\B
C\->\A
End
Disp A,B,A/B
\stop83\


begin 664 n2frac.83p
M*BI423@S*BH:"@!0<F]G<F%M(&9I;&4@9&%T960@,#8O,C8O.3<L(#$V.C(W
M``````````"A``L`D@`%3C)&4D%#``"2`)``<@18/S$$M5T`/S$$2C^Y6`1=
M`!!*/[I8!%@_T1`26"LY$6\P$4`02FLQ-C]*<#$$2C]8#`18/[E8!%T`$$H_
MNE@$6#_4/S]=`!!*!$$_,01"/UT`$$IQ,1%!<$($0S]!!$(_0P1!/]-+*TIQ
F,BLQ*[`Q/UT`$$L107!"!$,_001"/T,$03_4/]Y!*T(K08-"XB<`

end