Texas Instruments TI89 Developer Guide - Page 217
An Example of Working on the EStack, Appendix A: System Routines
![]() |
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 217 highlights
Chapter 15: Expressions and The Expression Stack 175 15.6. top expression with its reciprocal; and replace_top_with_post_simplified replaces the top expression (assumed to be internal form) with its external tokenized form. Routines whose names begin with "is_" are used to get information about expressions. They have no effect on the contents of the estack or the expressions they inspect. However, sometimes they must perform some temporary computation to determine the requested information. Under these circumstances the estack may temporarily grow. For example, is_negative tests whether an expression is negative; is_real tests whether an expression is real; and, is_equivalent_to tests whether one expression is equivalent to another. Routines whose names begin with "index_" or end with "_index" are used to locate expressions or subexpressions. They also have no effect on the estack or expressions. They simply return the EStackIndex of the located expression. For example, next_expression_index returns the index of the next expression below the expression pointed to by its input argument; lead_factor_index returns the index of the first factor of the multiplication pointed to by its input argument; and, remaining_factors_index returns the index of the remaining factors following the first factor of the multiplication pointed to by its input argument. See Appendix A: System Routines for a complete list of the system routines that perform estack operations. An Example of Working on the EStack This section takes a simple C language programming example and works through alternative implementations to show how the same operations can be done using estack operations. We begin with a C language implementation of a function to compute the future value of a lump sum present value given the periodic interest rate and the number of periods. The formula for this computation is future_value = present_value * ( interest_rate + 1) ^ number_of_periods. C programming language example: /* This function takes three BCD16 arguments. pv = present value ir = interest rate np = number of periods The function returns future value fv as a BCD16. */ BCD16 fv (BCD16 pv, BCD16 ir, BCD16 np) { return pv * pow(ir + 1.0, np); } TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001
![](/manual_guide/products/texas-instruments-ti89-developer-guide-95b636f/217.png)