EasyManua.ls Logo

Texas Instruments TI-89 - Floating Point Numbers

Texas Instruments TI-89
1398 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 16: Working with Numbers
183
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
Here is a coding example from a system routine which must temporarily alter this
mode setting. Numeric integration (
push_nint)
requires that all evaluation be
done with float numbers. So, this routine saves the mode, changes it, and
restores it before returning.
void push_nint (EStackIndex i, EStackIndex vi, EStackIndex j,
EStackIndex k)
{
Access_AMS_Global_Variables;
CONTROL_BITS old_NG_control = NG_control;
SET_ARITH_APPROX;
.
.
.
/* apply the quadrature algorithm */
.
.
.
NG_control = old_NG_control;
}
16.4. Floating Point Numbers
Applications can work with float numbers on the estack or in C floating-point
variables. The compiler supports two forms of floating-point values as described
in Chapter 2 of the compiler documentation. The calculator implementation uses
the standard C type double. The symbols BCD16 and Float are also defined to
be double. BCD16 is the recommended type for declaring floating-point variables
in applications.
This type uses a 16-digit mantissa and provides more accuracy. Thus, BCD16
variables provide the best results when implementing iterative algorithms that
require a great deal of floating-point computation.
push_Float
is the routine that converts a C floating-point value into a tagged
floating-point value on the expression stack. The 16-digit value is rounded to
14-digits, pushed onto the estack, and then a FLOAT_TAG is pushed on top.
BCD floating point supports floating point infinities. However,
push_Float
converts these values to their symbolic equivalents. In other words,
push_Float
converts a floating point plus infinity to PLUS_INFINITY_TAG, a floating point
minus infinity to MINUS_INFINITY_TAG, a floating point unsigned infinity to
PLUS_OR_MINUS_INFINITY_TAG, and a floating point NAN to
UNDEFINED_TAG.
BCD floating point supports an exponent range from -16384 to 16383. Tagged
float exponents are limited to the calculator range of -999 to 999.
push_Float
converts overflow values to the corresponding symbolic infinity and underflow
values to zero. Thus, while any tagged float can be moved into a C floating point
variable, not all C floating point values can be converted to tagged floats.

Table of Contents

Other manuals for Texas Instruments TI-89

Related product manuals