Appendix A: System Routines — Math
787
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
push_gcd_then_cofactors
Declaration:
EStackIndex
push_gcd_then_cofactors
(EStackIndex
i
, EStackIndex
j
,
EStackIndex *
p
)
Category(ies):
Math
Description:
Pushes onto the estack the greatest common denominator (gcd) of
i
and
j
,
then (expression
j
)/gcd then (expression
i
)/gcd. Stores the index of
(expression
j
)/gcd in *
p
then returns the index of the gcd.
Inputs:
i
,
j
— Indices of the top tags of algebraic expressions.
p
— The address of an EStackIndex.
Outputs:
Index of (expression
j
)/gcd.
Assumptions:
None
Side Effects:
None
Availability:
On AMS 2.02 and higher.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also:
None
Example:
EStackIndex index_push_monic_or_prim_pair (EStackIndex i, EStackIndex j)
/* If i indexes a Float, pushes 1.0 then the ratio of expressions j and i.
Otherwise pushes i/gcd(i, j) then j/gcd(i, j).
In either case, returns the index of the deeper pushed value.
*/
{ Access_AMS_Global_Variables;
EStackIndex k;
if (FLOAT_TAG == ESTACK (i))
{ push_expression (Float1Index);
k = top_estack;
push_ratio (j, i);
}
else
{ EStackIndex old_top = top_estack;
EStackDisplacement del =
deleted_between (old_top, push_gcd_then_cofactors (j, i, &k));
k -= del;
}
return k;
}