Routines |
Prev: 14099 | Up: Map | Next: 14250 |
The address of this routine is found in the table of addresses. It is called via the calculator literal 57 by the routines at cos and sin.
This subroutine transforms the argument X of SIN X or COS X into a value V.
The subroutine first finds the value Y=X/2π-INT(X/2π+0.5), where -0.5<=Y<0.5.
The subroutine returns with:
In each case, -1<=V<=1 and SIN (πV/2)=SIN X.
|
||||
get_argt | 14211 | RST 40 | X | |
14212 | DEFB 61 | re_stack: X (in full floating-point form) | ||
14213 | DEFB 52 | stk_data: X, 1/2π | ||
14214 | DEFB 238,34,249,131,110 | |||
14219 | DEFB 4 | multiply: X/2π | ||
14220 | DEFB 49 | duplicate: X/2π, X/2π | ||
14221 | DEFB 162 | stk_half: X/2π, X/2π, 0.5 | ||
14222 | DEFB 15 | addition: X/2π, X/2π+0.5 | ||
14223 | DEFB 39 | int: X/2π, INT (X/2π+0.5) | ||
14224 | DEFB 3 | subtract: X/2π-INT (X/2π+0.5)=Y | ||
Note: adding 0.5 and taking INT rounds the result to the nearest integer.
|
||||
14225 | DEFB 49 | duplicate: Y, Y | ||
14226 | DEFB 15 | addition: 2*Y | ||
14227 | DEFB 49 | duplicate: 2*Y, 2*Y | ||
14228 | DEFB 15 | addition: 4*Y | ||
14229 | DEFB 49 | duplicate: 4*Y, 4*Y | ||
14230 | DEFB 42 | abs: 4*Y, ABS (4*Y) | ||
14231 | DEFB 161 | stk_one: 4*Y, ABS (4*Y), 1 | ||
14232 | DEFB 3 | subtract: 4*Y, ABS (4*Y)-1=Z | ||
14233 | DEFB 49 | duplicate: 4*Y, Z, Z | ||
14234 | DEFB 55 | greater_0: 4*Y, Z, (1/0) | ||
14235 | DEFB 192 | st_mem_0: (mem-0 holds the result of the test) | ||
14236 | DEFB 0 | jump_true to ZPLUS: 4*Y, Z | ||
14237 | DEFB 4 | |||
14238 | DEFB 2 | delete: 4*Y | ||
14239 | DEFB 56 | end_calc: 4*Y=V (case i) | ||
14240 | RET | Finished. | ||
If the jump was made then continue.
|
||||
ZPLUS | 14241 | DEFB 161 | stk_one: 4*Y, Z, 1 | |
14242 | DEFB 3 | subtract: 4*Y, Z-1 | ||
14243 | DEFB 1 | exchange: Z-1, 4*Y | ||
14244 | DEFB 54 | less_0: Z-1, (1/0) | ||
14245 | DEFB 0 | jump_true to YNEG: Z-1 | ||
14246 | DEFB 2 | |||
14247 | DEFB 27 | negate: 1-Z | ||
YNEG | 14248 | DEFB 56 | end_calc: 1-Z=V (case ii) or Z-1=V (case iii) | |
14249 | RET | Finished. |
Prev: 14099 | Up: Map | Next: 14250 |