392
Appendix A: System Routines — Direct Floating Point Operations
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
ck_valid_float
Declaration:
BOOL
ck_valid_float
(BCD16 *
num
)
Category:
Direct Floating Point Operations
Description:
Verifies that a floating-point value is within the valid user range. The
internal TI BCD floating-point format has 16 mantissa digits with an
exponent range of -16384 to 16383 while a valid user float is 14 mantissa
digits with an exponent range of -999 to 999.
ck_valid_float
rounds the
input BCD16 value
num
to 14 digits and underflows the value to 0 if the
exponent is less than -999. If
num
is NAN or the exponent is greater than
999, FALSE is returned and
num
will contain a NAN. (See section
2.9.4. Floating-Point Representations
in the TI-89 / TI-92 Plus Sierra C
Assembler Reference Manual.)
Inputs:
num
— Pointer to a TI BCD floating-point value (BCD16).
Outputs:
num
is rounded to 14 mantissa digits or underflowed to 0 if necessary to
insure that its contents are within the range of a user floating-point value. In
this case, TRUE will be returned. If the input
num
is NAN or the exponent is
greater than 999, the output value of
num
will be NAN and FALSE will be
returned.
Assumptions:
None
Side Effects:
None
Availability:
All versions of the TI-89 / TI-92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: is_float_transfinite, push_Float
Example:
/* convert an internal floating point value to the range of a user float */
if( !ck_valid_float( &temp )) /* does round14 and underflows if necessary */
ER_throw( ER_OVERFLOW ); /* could not convert to valid user float range */