repo.or.cz
/
eigenmath-fx.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git]
/
cosh.cpp
blob
d2e9237ecba3413b837a6b8ae7f1f19bb05cab10
1
// exp(x) + exp(-x)
2
// cosh(x) = ----------------
3
// 2
4
5
#include
"stdafx.h"
6
#include
"defs.h"
7
8
void
9
eval_cosh
(
void
)
10
{
11
push
(
cadr
(
p1
));
12
eval
();
13
ycosh
();
14
}
15
16
void
17
ycosh
(
void
)
18
{
19
save
();
20
yycosh
();
21
restore
();
22
}
23
24
void
25
yycosh
(
void
)
26
{
27
double
d
;
28
p1
=
pop
();
29
if
(
car
(
p1
) ==
symbol
(
ARCCOSH
)) {
30
push
(
cadr
(
p1
));
31
return
;
32
}
33
if
(
isdouble
(
p1
)) {
34
d
=
cosh
(
p1
->
u
.
d
);
35
if
(
fabs
(
d
) <
1e-10
)
36
d
=
0.0
;
37
push_double
(
d
);
38
return
;
39
}
40
if
(
iszero
(
p1
)) {
41
push
(
one
);
42
return
;
43
}
44
push_symbol
(
COSH
);
45
push
(
p1
);
46
list
(
2
);
47
}