422
Appendix A: System Routines — Direct Floating Point Operations
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
push_Float_to_nonneg_int
Declaration:
void
push_Float_to_nonneg_int
(Float
f
)
Category(ies):
Direct Floating Point Operations
Description:
If the truncated integer part of
f
is representable as a big integer, that
tagged integer value is pushed onto the estack.
Inputs:
f
— Non-negative C floating-point number.
Outputs:
None
Assumptions:
None
Side Effects:
Throws RATIONAL_NUMERIC_OVERFLOW_ERROR if the truncated
integer part of
f
is not representable as a big integer.
Availability:
On AMS 1.05 and higher.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: push_Float
Examples:
Boolean did_push_cnvrt_Float_to_integer (EStackIndex i)
/* i indexes a tagged float.
If it is a whole number that is representable as an integer, pushes the
integer equivalent then returns TRUE.
Otherwise returns FALSE. */
{ Float f;
f = ESTACK_TO_FLOAT (i);
if (FLOAT0 == FMOD (f, FLOAT1))
{ Float abs_f = fabs (f);
if (FLOAT_TO_NON_OVERFLOW_THRESHOLD > abs_f)
{ push_Float_to_nonneg_int (abs_f);
if (f < FLOAT0)
negate_top()
return TRUE;
}
}
return FALSE;
}