Prev: 14211 Up: Map Next: 14261
14250: THE 'COSINE' FUNCTION (offset 32)
The address of this routine is found in the table of addresses. It is called via the calculator literal 32 by the routines at DRAW and tan. It is also called indirectly via fp_calc_2.
This subroutine handles the function COS X and returns a 'last value' 'that is an approximation to COS X.
The subroutine uses the expression COS X=SIN (πW/2), where -1<=W<=1.
In deriving W for X the subroutine uses the test result obtained in the previous subroutine and stored for this purpose in mem-0. It then jumps to the sin subroutine, entering at C_ENT, to produce a 'last value' of COS X.
cos 14250 RST 40 X
14251 DEFB 57 get_argt: V
14252 DEFB 42 abs: ABS V
14253 DEFB 161 stk_one: ABS V, 1
14254 DEFB 3 subtract: ABS V-1
14255 DEFB 224 get_mem_0: ABS V-1, (1/0)
14256 DEFB 0 jump_true to C_ENT: ABS V-1=W
14257 DEFB 6
If the jump was not made then continue.
14258 DEFB 27 negate: 1-ABS V
14259 DEFB 51 jump to C_ENT: 1-ABS V=W
14260 DEFB 3
Prev: 14211 Up: Map Next: 14261