|
|
1.1 root 1: //////////
2: / /usr/src/libm/i387/cosh87.s
3: / i387 mathematics library
4: / cosh(d), sinh(d)
5: //////////
6:
7: RASIZE = 4
8:
9: .globl cosh
10: .globl sinh
11: .globl _exp
12:
13: //////////
14: / double
15: / cosh(d)
16: / double d;
17: /
18: / double
19: / sinh(d)
20: / double d;
21: /
22: / cosh(d) = (exp(d) + 1/exp(d))/2
23: / sinh(d) = (exp(d) - 1/exp(d))/2
24: //////////
25:
26: d = RASIZE / arg offset
27:
28: cosh:
29: clc / Clear Carry to indicate cosh.
30: jmp .L0 / Go to common code.
31:
32: sinh:
33: stc / Set Carry to indicate sinh.
34:
35: .L0:
36: fldl d(%esp) / Load argument d.
37:
38: pushf / Save the Carry flag.
39: call _exp / exp(d)
40: fld %st / exp(d), exp(d)
41: fld1 / 1, exp(d), exp(d)
42: fdiv %st, %st(1) / 1/exp(d), exp(d)
43: popf / Restore the flags.
44: jnc ?1 / Jump if cosh.
45: fchs / -1/exp(d), exp(d) for cosh
46:
47: ?1:
48: fadd / exp(d) +- 1/exp(d)
49: fld1 / 1, exp(d) +- 1/exp(d)
50: fchs / -1, exp(d) +- 1/exp(d)
51: fxch / exp(d) +- 1/exp(d), -1
52: fscale / (exp(d) +- 1/exp(d)) / 2, -1
53: fstp %st(1) / (exp(d) +- 1/exp(d)) / 2
54: ret
55:
56: / end of cosh87.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.