I have a code to calculate the slope of a line if two points are known; however, it only returns the slope in decimal format. I'd like the ability to choose to convert the decimal to a fraction. Here's what I've done so far:
:Disp " "
:Input "PAIR 1: ",T
:Input "PAIR 2: ",U
:((LU(2)-LT(2))/(LU(1)-LT(2)))->M
:Disp "Slope Is: ",M
:Input "F>>D? Y/N: ",Str0
:If Str0="Y"
:(M>F<>D)->O
:Disp O
When I run this, I get ERROR: SYNTAX on the conversion step (the actual slope calculation completes successfully.)
**Some of the code I've typed above is not exactly how it appears in the TI 84, but it's the best I can do with a QWERTY keyboard.
►Frac
and ►F◄►D
are display tokens, not conversion tokensTI calculators can only store numbers one way: in their proprietary floating-point format. This means that numbers cannot be "converted" from fraction to decimal or vice versa, only displayed as fractions or decimals. Thus, storing to anything (e.g. 3►F◄►D→X
) will throw a syntax error.
Display modes are changed using the Auto
/Dec
/Frac
tokens in the MODE menu; ►Frac
overrides the mode and displays as a fraction approximation, ►Dec
displays as decimal, and ►F◄►D
tells the calculator to display in the opposite display mode from its current setting.
Quoting from this page:
►Frac attempts to display the input in fraction form. It only works on the home screen outside a program, or with the Disp and Pause commands in a program.