EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Developer's Guide

Texas Instruments TI-89
1398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #218 background imageLoading...
Page #218 background image
176
Chapter 15: Expressions and The Expression Stack
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
15.6.1. Estack Arguments and Results
Lets modify the future value function to accept its arguments as a tail on the
estack and return its result on the estack. This example continues to accept and
return only floating-point values. The changes use the following features.
An EstackIndex called arg is used to access each of the arguments in turn.
BCD16 variables fv, pv, ir, and np are declared to receive the argument
values and perform the computation.
The system function
next_expression_index
is used to step from each
argument to the next.
The system function
estack_to_float
is used to copy the tagged floats from
the estack into the BCD16 variables.
The system function
push_Float
is used to push the BCD16 result onto the
estack as a tagged float.
/* This function takes three tagged BCD16 arguments.
The arguments are required to be in a tail on top
of the expression stack in the following order.
pv = present value
ir = interest rate
np = number of periods
The function returns future value fv as a tagged
float on top of the expression stack.
*/
void fv (void)
{ EStackIndex arg; /* argument pointer */
BCD16 fv, pv, ir, np; /* BCD16 variables */
/* point arg to the first argument in the tail */
arg = top_estack;
/* get the present value argument */
pv = estack_to_float (arg);
/* advance the argument pointer to the next argument */
arg = next_expression_index (arg);
/* get the interest rate argument */
ir = estack_to_float (arg);
/* advance the argument pointer to the next argument */
arg = next_expression_index (arg);
/* get the number of periods argument */
np = estack_to_float (arg);
/* perform the future value calculation */
fv = pv * pow (ir + 1.0, np);
/* push the future value on the estack */
push_Float (fv);
}

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals