Appendix A: System Routines — Direct Floating Point Operations
425
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
round12_err
(continued)
Example:
The zoom trig on the grapher sets up the range variables depending on
the degrees/radians setting and the number of pixels in the X direction of
the graph as shown in this example. The xscl factor is rounded to
14 digits using
round14
but the xmin and xmax variables are rounded to
12 digits using
round12_err
.
void SysVarStore( short sysNum, BCD16 value )
{ Access_AMS_Global_Variables;
EStackIndex saveTop = top_estack;
BYTE tag[2];
tag[1] = SYSVAR_TAG;
tag[0] = sysNum;
push_Float( value );
VarStore( tag+1, STOF_ESI, 0, top_estack );
top_estack = saveTop;
}
void GZ_Trig( void )
{ Access_AMS_Global_Variables;
short xp;
BCD16 *fr, TempF;
fr = gr_active->rngp;
xp = gr_active->xmaxpix;
if (IS_DEGREES) {
SysVarStore( SV_DELTAX, 7.5 );
SysVarStore( SV_XSCL, FLOATTAB[FPI_90] );
} else {
SysVarStore( SV_DELTAX, FLOATTAB[FPI_PIDIV24] );
SysVarStore( SV_XSCL, round14(FLOATTAB[FPI_PIDIV2]) );
}
TempF = -(fr[GR_DELTAX] * xp) / FLOATTAB [FPI_2];
SysVarStore( SV_XMIN, round12_err( TempF, ER_RANGE ) );
SysVarStore( SV_XMAX, round12_err(fr[GR_DELTAX] * xp + TempF, ER_RANGE) );
SysVarStore( SV_YMIN, -4.0 );
SysVarStore( SV_YMAX, 4.0 );
SysVarStore( SV_YSCL, 0.5 );
GT_Regraph();
}