EasyManua.ls Logo

Texas Instruments TI-92+ - [6.9] Convert Floating-Point Numbers to Exact Fractions; [6.10] Exact Solutions to Cubic and Quartic Equations

Texas Instruments TI-92+
507 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Setting constraints on a and b may result in a more simple expression.
(Credit to Glenn Fisher)
[6.9] Convert floating-point numbers to exact fractions
The usual method to convert a floating-point number n to an exact fraction is to use exact(n). However,
this function will only work for numbers smaller that the 14-digit precision of the 89/92+. For example,
exact(1.234567890123456) results in 6172839450617/5000000000000, which is actually
1.23456789012; the ...3456 from the original number has been lost.
This program can be used to convert arbitrarily long floating point numbers to exact fractions.
stoexact(str)
Func
©Convert string argument to exact number
Local b,t,s
sign(expr(str))s
if inString(str,"")=1
right(str,dim(str)-1)str
inString(str,".")b
If b0 then
right(str,dim(str)-b)t
Return s*(exact(iPart(expr(str)))+exact(expr(t))/10^(dim(t)))
else
return exact(expr(str))
EndIf
EndFunc
The argument is passed as a string, for example
stoexact("1.234567890987654321")
returns 1234567890987654321/10000000000000000000.
This function works for positive and negative arguments, but does not support exponential notation.
(credit for original idea & core code to Kenneth C. Arnold)
[6.10] Exact solutions to cubic and quartic equations
The 89/92+ functions csolve() and czeros() will not always return exact solutions to cubic and quartic
equations. The routines cubic() and quartic() can be used to get the exact solutions.
cubic():
cubic(é,ý)
6 - 9

Table of Contents

Related product manuals