| Routines

3833: THE 'ARCSIN' FUNCTION (offset +22)

The address of this routine is found in the table of addresses. It is called via the calculator literal +22 by the routine at acs. It is also called indirectly via fp_calc_2. This subroutine handles the function ASN X and returns a real number from -π/2 to π/2 inclusive which is equal to the value in radians of the angle whose sine is X. Thereby if Y=ASN X then X=SIN Y. This subroutine uses the trigonometric identity TAN (Y/2)=SIN Y/(1+COS Y) to obtain TAN (Y/2) and hence (using ATN) Y/2 and finally Y.
asn | 3833 | RST $28 | X
| 3834 | DEFB $31 | duplicate: X, X
| 3835 | DEFB $31 | duplicate: X, X, X
| 3836 | DEFB $04 | multiply: X, X*X
| 3837 | DEFB $A1 | stk_one: X, X*X, 1
| 3838 | DEFB $03 | subtract: X, X*X-1
| 3839 | DEFB $1B | negate: X, 1-X*X
| 383A | DEFB $28 | sqr: X, SQR (1-X*X)
| 383B | DEFB $A1 | stk_one: X, SQR (1-X*X), 1
| 383C | DEFB $0F | addition: X, 1+SQR (1-X*X)
| 383D | DEFB $05 | division: X/(1+SQR (1-X*X))=TAN (Y/2)
| 383E | DEFB $24 | atn: Y/2
| 383F | DEFB $31 | duplicate: Y/2, Y/2
| 3840 | DEFB $0F | addition: Y=ASN X
| 3841 | DEFB $38 | end_calc
| 3842 | RET | Finished: 'last value'=ASN X.