|
|
1.1 root 1: //////////
2: / libm 8087
3: / cos(d), sin(d)
4: //////////
5:
6: #include "larges.h"
7: #include "ifno8087.h"
8:
9: .globl cos_
10: .globl sin_
11: .globl tan
12:
13: //////////
14: / double
15: / cos(angle)
16: / double angle;
17: /
18: / double
19: / sin(angle)
20: / double angle;
21: //////////
22:
23: d = RASIZE / arg offset
24:
25: cos_:
26: ifno8087(_cos_)
27: clc / Clear Carry for cos.
28: jmp 0f
29:
30: sin_:
31: ifno8087(_sin_)
32: stc / Set Carry for sin.
33:
34: 0: mov bx, sp
35: fdld Pss d(bx) / Load argument d.
36:
37: pushf / Save the flags.
38: Gcall tan / Get x, y.
39: fld st / x, x, y
40: fmul st,st / x*x, x, y
41: fld st2 / y, x*x, x, y
42: fmul st,st / y*y, x*x, x, y
43: fadd / x*x + y*y, x, y
44: fsqrt / r = sqrt(x*x + y*y), x, y
45: popf / Restore the flags.
46: jc 1f / Carry set for sin.
47: fdiv / cos(d) = x / r, y.
48: fstp st1 / Pop the stack, return result.
49: Gret
50:
51: 1: fstp st1 / r, y.
52: fdiv / sin(d) = y / r
53: Gret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.