User's Manual

iAPX286
MACRO
ASSEMBLER
LOC
OS,)
OOOE
OOOE
0009
0010
7501
00l:ii! C3
0013
0013
E80901
0016
E9:i!F
OOlS
001S
09E5
COlA
9DDFEO
00
I D 2EDIJ2EOOOO
0022
BIOI
0024
9E
0025
7263
0027
D9C9
OO:ii!9
7Ale
002D OD09
0020
75E4
NUMERIC PROGRAMMING EXAMPLES
80287
Trillnometric
Function5
10:
13:
51
091:25/83
PAGE
LINE
,.
20
21
22
23
••
2.
20
.7
2a
••
30
31
3.
33
3.
35
30
37
38
3.
.0
.,
.2
.3
••
45
+1
.0
.7
.a
••
50
31
••
53
••
55
.0
07
5e
5.
00
01
02
03
O.
OS
00
07
08
o.
70
71
7:1:
+1
73
7.
75
70
77
78
7.
eo
81
e.
e3
8.
e.
eo
87
e8
e.
.0
.,
••
.3
••
••
.0
.7
.e
••
100
101
10.
103
10.
10.
100
107
loa
10.
110
111
II.
SOURCE
,
:."
,
"Jllct
,
This
subroutine
calculate.
the
51ne
OT'
cosina
of
th.
4I"gle.
giv.n
in
Nldi.nll.
Tha
angle
is
in
SHO),
thll
T'llturnod
valu.
will
ba
in
STeO),
Th.
r
••
ult
h
ju:c:u"at.
to
within
7
unUs
of
th.
lI'i!IIst
significant
three
bitll
of
th.
NPX
utend&d
,.ul
format.
Tha
PL.M/B6
d.flinition
ill:
sina:
prot_durl
(angla)
1'1.1
axternall
daclare
angla
'1'
••
11
and
sin.,
COlina:
procadu,.a
<angl.)
"
...
1
axternall
dacla".
angla
,.
••
11
end
cOlinl1
Thrt'e
ltack
rellilterl
are
req,uir·ed.
The
result
0'
thl!
function
is
defined
al
follollls
for
thl'
follollling
arlluments:
angle
....
lid
unnormal
leSI
th.n
2**62
in
magnitude
zero
denormal
...
al
id
or
unnormal
greater
than
2**62
infinity
NAN
'mpty
relult
correc:t
....
lu
o
or
1
correct
denormal
ind.'inite
indeHnit:e
NAN
Itmpty
Thi.
fUnc:tion
il
b.ud
on
the
NPX
fptan
instruction.
The
fptan
in.truction
IUlll
only
lUork
with
an
angle
of
from
0
to
PI/4.
With
th:l.!i
.in.truction,
the
.ine
or
cOlinl"
of!
angl.1
f!rom 0
to
Pl/4
can
b.
ar::curately
calculated.
Th.
ter::hniq.uI
und
by
thh
routine
can
r::alr::ulat.
a
gl"l1".l
line
or
r::osine
by
uling
on.
of!
four
pO.libll
op.ration.:
Lit
R ..
langle
mod
PI/41
S ..
-1
1,
ar::r::ording
to
thl
sign
of
the
.n)l1ll
2)
co.eR)
3)
.inCPI/4-R)
4)
COICPI/4-RI
Thl
r::hoir::.
of
the
relation
and
the
sign
of
thl
ruult
follows
the
d.ci.ion
tabl.
Ihown
belolll
baud
on
the
octant
the
angl.
f.ll1
in:
octant
lint
c
olinl
."
•••
S*.
-1*1
S*3
-1*4
-9*1
-1*2
-9*4
-1*3
-6*2
1
-9*3
Angle
to
lin.
f!unction
il
a
zero
or
unnormal.
s i
n'_1
Iro_unnormill:
,
fltp
Jnz
It
C
1)
entlr
_I
i
nl_normal
i z It
Angle
il
II
nro.
..
t
Angle
il
an
unnoT'mal.
'ntlr
_.i
nt_normal
i
z.:
c<lll
normalize_"alul
J.mp
Ihort
Intlr_lin.
COlin.
proc
ham
fits'"
..
'Id
P
i_q,uart.r
mav
cl,l
uhf
J'
funnYJar.mltlr
Angle
i.
unnol"mal.
normal,
hch
JP'
.nt,r_Iln"
Angh
i.
.n
unnormal
htp
It(
1)
Jnz
"nt.r
_,
i
n,,_normal
i z
eo
Anlllt
i.
.
z.ro.
cosCO)
.
1.0
I
RlmO"1
PI
14
I Jump
i,
angle
is
unno't'mal
J
Entry
point
to
r::olin'
Look
at
thl
"alul
Star,
Itatul
""41uI
I
SltUP
for
angl.
r,duel
6illnal
COlin.
funr::tion
ZF
..
C3.
PF
..
C2,
CF
..
CO
I Jump
1f
par.m.ter
i.
I Imptl,!.
NAN.
or
infinity
d.norm.l.
I
stCO)
..
angle.
It'l)
..
PI/4
I Jump
if
normal
01"
d
.normal
Figure 4-7. Calculating Trigonometric Functions (Cont'd.)
4-19