User's Manual

iAPX2B6
MACRO
ASSEMBLER
LOC
DB'"
OOBD
OOBD
D9E5
DOOF
9BDFEO
OOC:;!:
2EDB2EOOOO
OOC7
9E
OOCS
72CO
·OOCA D9CQ
coce
7i117
aOCE
DOCE
D9FB
0000
93
0001
9BDFEO
OOD4
93
0005
F6C704
OODS
7S0D
OODA
D9El
CODe
F6C702
OODF
740E
OOEI DEE9
OOE3
EBIS
ODES
ODE'
DDD9
OOE7
7405
NUMERIC PROGRAMMING EXAMPLES
80287
Trignometric
Functions
10: 13:
51
09/25/83
PI\QE
LINE
301
302
303
304
30S
306
307
308
30.
310
311
31'
313
314
31S
316
317
318
31'
320
321
32.
323
324
32.
3.6
327
328
32.
330
331
332
333
334
335
336
337
338
33.
340
341
34.
343
344
34S
346
347
348
34'
350
351
352
353
354
355
356
357
358
35.
360
361
36.
363
364
365
366
367
368
36.
370
371
372
373
374
375
376
377
378
37.
380
381
38.
383
380
385
386
387
388
38.
3.0
3"
392
3.3
3"
3.5
SOURCE
least
three
signUieant
bits
of
an
extended
T'eal
format
number,
The
PLM/S6
c.alling
fOTmat
is:
tangent:
proceduT'1!
Cangle)
1'8al
external;
declare
angle
reall
end
tangentl
TIIIO
stack
registers
are
used.
The
re5ult
of
the
tangent
function
is
defined
for
the
follollling
cases:
angle
Tll'sult
vali.d
01'
unnormal
<
2**62
in
magnitude
o
correct
value
o
denol'mal
valid
Dr
unnormal
>
2**b2
in
magnitude
NAN
correct
denormal
indefinite
NAN
infinity
indefinite
empty
Itmptl,!
The
tangent
in.tt'uction
uses
the
fptan
instruction.
relations
are
used:
Four
possible
l..et
R a
langle
HOD
PI/41
B
...
-lor
1
depend
ing
the
sign
of
the
angle
1 l
teneR)
2)
tan1PI/4-Rl
3)
l/tanlR)
4)
l/tanCPI/4-R)
The
fo1101111"g
table
is
used
to
decide
which
relation
to
use
depending
on
in
IIIhich
octant
the
angle
fell.
octant
,
tangent
proc
fxam
fstslll
ax
fld
pi_Cl.uilrte,.
sahf
JC
funn\lJilrameter
l.ook
at
tfie
parameter
get
ham
.tatus
I
get
PI/4
I
CF
=
co.
PF"'C2.
ZF"'C3
or
denol'mal.
fxch
JPe
Angle
is
either
an
normal
01'
denormal.
I
steO)
...
angle.
stll)
...
PI/4
Reduce
the
angle
to
the
range
-PI/4
<
result
<
PI/4.
If
fprem
cannot
perform
this
operation
in
one
try.
the
magnitude
of
the
angle
must
be )
2**b2.
Such
an
angle
is
so
large
that
an\!
rounding
errors
could
make a verI,!
large
difference
in
the
reduced
angle.
It
ls
safest
to
call
tllis
verl,l
rare
case
an
et'ror.
fprem
xchg
ax.
bx
fstsbl
xchg
ax.
bx
test
bh,
highlmask
cond2)
Jnz
angle_tao_big
See
if
the
angle
must
be
reversed.
Assert:
-PI/4
<
steO)
<
PI/4
fabs
test
J'
bh.
highlmask
condl)
no_tan_reverse
Quotient
in
CO.
C3.
Cl
Convert
denormals
into
unnormals
I
Quotient
identifies
octant
original
angle
fell
into
Test
for
complete
reduction
I
Exit
if
angle
bias
too
big
I 0
<=
stlO)
<
P1I4
C3
In
bl
has
the
sign
flag
I
must
be
revet-sed
Angle
fell
in
octants
1.3.5.7.
Neverse
It,
sUO'li'ratl;
ii.
i"um
~:;,;..;.
fsub
I
Reverse
angle
Jmp
short
do_tangent
Angle
is
either
zero
or
an
unnormal.
,
tan_zero_unnormal:
stll)
Angle
is
an
unnormal.
; Remove
PI/4
Figure 4-7. Calculating Trigonometric Functions (Cont'd.)
4-22