Prev: 14250 Up: Map Next: 14298
14261: THE 'SINE' FUNCTION (offset 31)
The address of this routine is found in the table of addresses. It is called via the calculator literal 31 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.
sin 14261 RST 40 X
Perform step i.
14262 DEFB 57 get_argt: W
Perform step ii. The subroutine from now on is common to both the SINE and COSINE functions.
C_ENT 14263 DEFB 49 duplicate: W, W
14264 DEFB 49 duplicate: W, W, W
14265 DEFB 4 multiply: W, W*W
14266 DEFB 49 duplicate: W, W*W, W*W
14267 DEFB 15 addition: W, 2*W*W
14268 DEFB 161 stk_one: W, 2*W*W, 1
14269 DEFB 3 subtract: W, 2*W*W-1=Z
Perform step iii, passing to the series generator the parameter '6' and the six constants required.
14270 DEFB 134 series_06: W, Z
14271 DEFB 20,230
14273 DEFB 92,31,11
14276 DEFB 163,143,56,238
14280 DEFB 233,21,99,187,35
14285 DEFB 238,146,13,205,237
14290 DEFB 241,35,93,27,234
At the end of the last loop the 'last value' is (SIN (π*W/2))/W.
Perform step iv.
14295 DEFB 4 multiply: SIN (π*W/2)=SIN X (or COS X)
14296 DEFB 56 end_calc
14297 RET Finished: 'last value'=SIN X (or COS X).
Prev: 14250 Up: Map Next: 14298