Intel 80286, 80287 manual 207

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 475
Image 475

NUMERIC PROGRAMMING EXAMPLES

iAPX286 MACRO ASSEMBLER

80287

Trillnometric Function5

10: 13: 51 091:25/83 PAGE

LOC OS,)

LINE

SOURCE

 

 

,.

 

 

20

21

22

23

••

2.

.207

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

O.

03 :."

OS

00

07

08

o.

70 ,

71

7:1: +1 "Jllct

73

7. ,

75

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

relult

 

.... lid

unnormal leSI th.n 2**62 in magnitude

correc:t

.... lu •

zero

 

o or 1

 

denormal

 

correct

denormal

...al id or

unnormal greater than 2**62

ind.'inite

infinity

 

indeHnit:e

NAN

 

NAN

 

'mpty

 

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.

OOOE

OOOE 0009

0010 7501

00l:ii! C3

70s i n'_1 Iro_unnormill:

78

 

fltp

It C1)

I RlmO"1

PI 14

7.

 

Jnz

entlr _I i nl_normal i z It

I Jump i,

angle is unno't'mal

eo

 

 

 

 

 

81

 

Angle il II nro.

 

 

e.

 

.. t

 

 

 

e3

 

 

 

 

8.

,

Angle

il an unnoT'mal.

 

 

eo

 

 

e.

 

 

 

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

87 'ntlr _.i nt_normal i z.:

e8

 

 

e.

c<lll

normalize_"alul

.0,

J.mp

Ihort Intlr_lin.

.••3

proc

..

COlin.

••

fits'"ham

••0

'Id

P i_q,uart.r

.7

mav

cl,l

.e

uhf

 

100••

J'

funnYJar.mltlr

101

 

 

10.

Angle

i . unnol"mal. normal,

103

 

 

10.

hch

 

10.

JP'

.nt,r_Iln"

100

 

 

J Entry point to r::olin'

Look at thl "alul

Star, Itatul ""41uI

ISltUP 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.

IstCO) .. angle. It'l) .. PI/4 I Jump if normal 01" d .normal

002D OD09

0020 75E4

107Angh i . .n unnormal

loa

10

htp

It( 1)

. 1.0

II.

Anlllt

i . . z.ro. cosCO)

110

Jnz

"nt r _, i n,,_normal i z eo

111

 

 

 

Figure 4-7. Calculating Trigonometric Functions (Cont'd.)

4-19

Page 475
Image 475
Intel 80286, 80287 manual 207