UNPKG

697 Btext/coffeescriptView Raw
1### cosh =====================================================================
2
3Tags
4----
5scripting, JS, internal, treenode, general concept
6
7Parameters
8----------
9x
10
11General description
12-------------------
13Returns the hyperbolic cosine of x
14
15```
16 exp(x) + exp(-x)
17 cosh(x) = ----------------
18 2
19```
20
21###
22
23Eval_cosh = ->
24 push(cadr(p1))
25 Eval()
26 ycosh()
27
28ycosh = ->
29 save()
30 yycosh()
31 restore()
32
33yycosh = ->
34 d = 0.0
35 p1 = pop()
36 if (car(p1) == symbol(ARCCOSH))
37 push(cadr(p1))
38 return
39 if (isdouble(p1))
40 d = Math.cosh(p1.d)
41 if (Math.abs(d) < 1e-10)
42 d = 0.0
43 push_double(d)
44 return
45 if (iszero(p1))
46 push(one)
47 return
48 push_symbol(COSH)
49 push(p1)
50 list(2)
51