Rational Numbers; Estack Arithmetic - Texas Instruments TI-89 Developer's Manual

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Chapter 16: Working with Numbers
number into a BCD16 float value. push_Float as previously described is the
primary routine for converting a BCD16 float value into a tagged float value on
the expression stack.
See Appendix B: Global Variables — Direct Floating Point Operations for
details on commonly used stored BCD16 values and how to access them. Also
see Appendix B: Global Variables — Math for a description of global
EStackIndexes of stored floating point values.
16.5.

Rational Numbers

The rational system operates on the expression stack. The range of tagged
integers is approximately from -10^614 to 10^614, which is much larger than the
range of C integer variables. This is the opposite situation from the float system.
Any C integer can be converted to a tagged integer, but most tagged integers are
too large to fit in C integer variables. Also C does not support a "fraction" variable
type to correspond to tagged fractions.
The system provides some routines to convert between C integers and tagged
integers. push_long_to_integer, push_ulong_to_integer, and
push_ushort_to_integer provide the means to convert C integers to tagged
integers on the estack. estack_to_short and estack_to_ushort convert tagged
integers to C integers. See Appendix A: System Routines — EStack Utilities
for descriptions of these routines.
Since the float range is bigger than the rational range, rational overflows and
underflows quietly convert to float values. Clearly any rational value can be
converted to a corresponding float value, but some floats are outside the rational
range and cannot be converted to rational values. estack_number_to_Float is
the primary routine for converting rational values to floating-point values.
push_Float_to_rat is the primary routine for converting floating-point values to
rational values. See Appendix A: System Routines for descriptions of these
routines.
See Appendix B: Global Variables — Math for a description of global
EStackIndexes of stored rational values.
16.6.

EStack Arithmetic

Performing numeric operations on the expression stack is simple, because the
system routines understand all the tagged data types in the internal tokenized
form and how to operate on them appropriately. For example, to add two values,
simply pass the two values to the push_sum routine. push_sum understands
tagged integers, tagged fractions, tagged floats, and in fact, all algebraic data
TI-89 / TI-92 Plus Developer Guide
Not for Distribution
185
Beta Version January 26, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents