RationalRetractions(S)

retract.spad line 52 [edit on github]

rational number testing and retraction functions. Date Created: March 1990

rational : S -> Fraction(Integer)

rational(x) returns x as a rational number; error if x is not a rational number.

rational? : S -> Boolean

rational?(x) returns true if x is a rational number, false otherwise.

rationalIfCan : S -> Union(Fraction(Integer), "failed")

rationalIfCan(x) returns x as a rational number, "failed" if x is not a rational number.