Routines
 Prev: 37AA Up: Map Next: 37DA
37B5: THE 'SINE' FUNCTION (offset +1F)
The address of this routine is found in the table of addresses. It is called via the calculator literal +1F by the routines at DRAW, CD_PRMS1 and tan. It is also called indirectly via fp_calc_2.
This subroutine handles the function SIN X and is the third of the four routines that use the series generator to produce Chebyshev polynomials.
The approximation to SIN X is found as follows:
• i. The argument X is reduced to W, such that SIN (π*W/2)=SIN X. Note that -1<=W<=1, as required for the series to converge.
• ii. The argument Z=2*W*W-1 is formed.
• iii. The series generator is used to return (SIN (π*W/2))/W.
• iv. Finally a simple multiplication by W gives SIN X.
Input
Output
sin 37B5 RST \$28 X
Perform step i.
37B6 DEFB \$39 get_argt: W
Perform step ii. The subroutine from now on is common to both the SINE and COSINE functions.
C_ENT 37B7 DEFB \$31 duplicate: W, W
37B8 DEFB \$31 duplicate: W, W, W
37B9 DEFB \$04 multiply: W, W*W
37BA DEFB \$31 duplicate: W, W*W, W*W
37BB DEFB \$0F addition: W, 2*W*W
37BC DEFB \$A1 stk_one: W, 2*W*W, 1
37BD DEFB \$03 subtract: W, 2*W*W-1=Z
Perform step iii, passing to the series generator the parameter '6' and the six constants required.
37BE DEFB \$86 series_06: W, Z
37BF DEFB \$14,\$E6
37C1 DEFB \$5C,\$1F,\$0B
37C4 DEFB \$A3,\$8F,\$38,\$EE
37C8 DEFB \$E9,\$15,\$63,\$BB,\$23
37CD DEFB \$EE,\$92,\$0D,\$CD,\$ED
37D2 DEFB \$F1,\$23,\$5D,\$1B,\$EA
At the end of the last loop the 'last value' is (SIN (π*W/2))/W.
Perform step iv.
37D7 DEFB \$04 multiply: SIN (π*W/2)=SIN X (or COS X)
37D8 DEFB \$38 end_calc
37D9 RET Finished: 'last value'=SIN X (or COS X).
 Prev: 37AA Up: Map Next: 37DA