4.8 Standard Quotients

A standard quotient is a pair of standard forms (numr .∕ denr), in LISP represented as (numr . denr). If the denominator is trivial, the standard form 1 is used. The constructor, selector and conversion functions are



numr(q)select the numerator part
denr(q)select the denominator part
f2q(f)convert a standard form f to SQ
simp(a)convert algebraic form a to SQ
prepsq(q)convert SQ to algebraic form


Arithmetic with standard quotients is performed by the functions



addsq(q1,q2)q1 + q2
negsq(q)-q
subtrsq(q1,q2)q1-q2
multsq(q1,q2)q1*q2
quotsq(q1,q2)q1∕q2


Note that there is no zero test for standard quotients; instead use the zero test for the numerator null(numr(q)).

When should you use standard quotients and when standard forms? If you are sure that no denominator other than one can occur you should use standard forms, otherwise standard quotients are the only possible choice. You can of course mix arithmetic with both, however that strategy is not recommended unless you keep track carefully; debugging is hard. Arithmetic functions have been coded for maximum efficiency: none of them test the validity of their arguments.