|
|
1.1 root 1: //////////
2: / libm 8087
3: / atan(d)
4: //////////
5:
6: #include "larges.h"
7: #include "ifno8087.h"
8:
9: .globl atan_
10: .globl atan
11: .globl cfcc87
12: .globl tstcc
13:
14: //////////
15: / double
16: / atan(d)
17: / double d;
18: /
19: / Uses fpatan, which requires 0 < st1 < st.
20: //////////
21:
22: d = RASIZE / arg offset
23:
24: atan_:
25: ifno8087(_atan_)
26: mov bx, sp
27: fdld Pss d(bx) / Load argument d.
28:
29: atan: / d
30: Gcall tstcc
31: je 3f / d = 0, just return it.
32: pushf / Save the flags.
33: ja 0f / d is positive.
34: fchs / d is negative, negate it.
35:
36: 0: fld1 / Load a 1.
37: fcom
38: Gcall cfcc87 / Compare 1 to d.
39: jae 1f / 1 >= d, ok.
40: fdivr st1, st / and set d = 1/d.
41:
42: 1: fpatan / Result = atan(d/1).
43: jae 2f / 1 >= d, OK as is.
44: fild cs:minus1 / -1, result
45: fldpi / pi, -1, result
46: fscale / pi/2, -1, result
47: fstp st1 / pi/2, result
48: fsubr / Result = pi/2 - result.
49:
50: 2: popf / Restore the sign flag.
51: jae 3f / Positive, done.
52: fchs / Result = -result.
53:
54: 3: Gret
55:
56: / Data.
57: minus1: .word -1
58:
59: / end of atan87.m
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.