|
|
1.1 root 1: //////////
2: / /usr/src/libm/i387/atan287.s
3: / i387 mathematics library
4: / atan2(y, x)
5: //////////
6:
7: RASIZE = 4
8:
9: .globl atan2
10: .globl _cfcc
11: .globl _tstcc
12:
13: //////////
14: / double
15: / atan2(y, x)
16: / double y, x;
17: //////////
18:
19: y = RASIZE / y arg offset
20: x = RASIZE+8 / x arg offset
21:
22: atan2:
23: fldl y(%esp) / Load argument y.
24: fldl x(%esp) / Load argument x.
25:
26: call _tstcc
27: jne ?1 / Jump if x nonzero.
28: fcompp / x = 0, compare 0 to y and pop x and y.
29: call _cfcc
30: fld1 / 1
31: fchs / -1
32: fldpi / pi, -1
33: fscale / pi/2, -1
34: fstp %st(1) / pi/2
35: jbe ?0 / 0 <= y, return pi/2.
36: fchs / 0 > y, return -pi/2.
37:
38: ?0:
39: ret
40:
41: ?1:
42: fpatan / atan(y/x)
43: ret
44:
45: / end of atan287.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.