Appendix A: System Routines — EStack Arithmetic
467
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
compare_numbers
Declaration:
int
compare_numbers
(EStackIndex
i
, EStackIndex
j
)
Category(ies):
EStack Arithmetic
Description:
Compares the two numbers indexed by
i
and
j
.
Inputs:
i, j
— Indexes to tagged numbers.
Outputs:
Returns 0 if the numbers indexed by
i
and
j
are equal, even if one is Float
and one is rational. Returns a positive integer if the number indexed by
i
is
greater than the number indexed by
j
. Returns a negative integer if the
number indexed by
i
is less than the number indexed by
j
. For this function,
all zeros are considered equal: 0 = +0 =
L
0 = +0.0 =
L
0.0 = 0.0.
Assumptions:
i
and
j
point to the numeric tags of tagged numbers. Note that PI_TAG and
IM_RE_TAG are not considered numeric tags.
Side Effects:
Might temporarily push items onto the estack.
Availability:
On AMS 2.02 and higher.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: compare_Floats, compare_complex_magnitudes,
compare_expressions
Examples:
/* Return j if it indexes a larger magnitude number than k indexes.
Otherwise return k: */
return compare_numbers(j,k) > 0 ? j : k;