CPU-Z80-Disassembler
view release on metacpan or search on metacpan
t/data/zx81.ctl view on Meta::CPAN
1DAC:B
1DAC-1DAC E6 :B
:;;Exponent: $76, Bytes: 4
1DAD:B
1DAD-1DB0 B50936BE :B
:;;
1DB1:B
1DB1-1DB1 E9 :B
:;;Exponent: $79, Bytes: 4
1DB2:B
1DB2-1DB5 36731B5D :B
:;;
1DB6:B
1DB6-1DB6 EC :B
:;;Exponent: $7C, Bytes: 4
1DB7:B
1DB7-1DBA D8DE63BE :B
:;;
1DBB:B
1DBB-1DBB F0 :B
:;;Exponent: $80, Bytes: 4
1DBC:B
1DBC-1DBF 61A1B30C :B
:;;
:;
1DC0:B
1DC0-1DC0 04 :B
:;;multiply
1DC1:B
1DC1-1DC1 0F :B
:;;addition
1DC2:B
1DC2-1DC2 34 :B
:;;end-calc
:;
1DC3:C
1DC3 C9 ret :C
:; return.
:;
:;
1DC4:C
:#; ---------------------
:#; THE 'ARCSIN' FUNCTION
:#; ---------------------
:#; (Offset $1F: 'asn')
:#; The inverse sine function with result in radians.
:#; Derived from arctan function above.
:#; Error A unless the argument is between -1 and +1 inclusive.
:#; Uses an adaptation of the formula asn(x) = atn(x/sqr(1-x*x))
:#;
:#;
:#; /|
:#; / |
:#; 1/ |x
:#; /a |
:#; /----|
:#; y
:#;
:#; e.g. We know the opposite side (x) and hypotenuse (1)
:#; and we wish to find angle a in radians.
:#; We can derive length y by Pythagoras and then use ATN instead.
:#; Since y*y + x*x = 1*1 (Pythagoras Theorem) then
:#; y=sqr(1-x*x) - no need to multiply 1 by itself.
:#; So, asn(a) = atn(x/y)
:#; or more fully,
:#; asn(a) = atn(x/sqr(1-x*x))
:#
:#; Close but no cigar.
:#
:#; While PRINT ATN (x/SQR (1-x*x)) gives the same results as PRINT ASN x,
:#; it leads to division by zero when x is 1 or -1.
:#; To overcome this, 1 is added to y giving half the required angle and the
:#; result is then doubled.
:#; That is, PRINT ATN (x/(SQR (1-x*x) +1)) *2
:#;
:#;
:#; . /|
:#; . c/ |
:#; . /1 |x
:#; . c b /a |
:#; ---------/----|
:#; 1 y
:#;
:#; By creating an isosceles triangle with two equal sides of 1, angles c and
:#; c are also equal. If b+c+d = 180 degrees and b+a = 180 degrees then c=a/2.
:#;
:#; A value higher than 1 gives the required error as attempting to find the
:#; square root of a negative number generates an error in Sinclair BASIC.
:#
:#;; asn
1DC4 EF rst $28 :C asn
:;; FP-CALC x.
1DC5:B
1DC5-1DC5 2D :B
:;;duplicate x, x.
1DC6:B
1DC6-1DC6 2D :B
:;;duplicate x, x, x.
1DC7:B
1DC7-1DC7 04 :B
:;;multiply x, x*x.
1DC8:B
1DC8-1DC8 A1 :B
:;;stk-one x, x*x, 1.
( run in 0.617 second using v1.01-cache-2.11-cpan-39bf76dae61 )