|
|
1.1 root 1: //////////
2: / libm 8087
3: / cosh(d), sinh(d)
4: //////////
5:
6: #include "larges.h"
7: #include "ifno8087.h"
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: ifno8087(_cosh_)
30: clc / Clear Carry to indicate cosh.
31: jmp 0f / Go to common code.
32:
33: sinh_:
34: ifno8087(_sinh_)
35: stc / Set Carry to indicate sinh.
36:
37: 0:
38: mov bx, sp
39: fdld Pss d(bx) / Load argument d.
40:
41: pushf / Save the Carry flag.
42: Gcall exp / exp(d)
43: fld st / exp(d), exp(d)
44: fld1 / 1, exp(d), exp(d)
45: fdiv st,st1 / 1/exp(d), exp(d)
46: popf / Restore the flags.
47: jnc 1f / Jump if cosh.
48: fchs / -1/exp(d), exp(d) for cosh
49:
50: 1: fadd / exp(d) +- 1/exp(d)
51: fidiv cs:two / (exp(d) +- 1/exp(d)) / 2
52: Gret
53:
54: //////////
55: / data
56: //////////
57: two: .word 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.