UNPKG

740 Btext/coffeescriptView Raw
1### arctanh =====================================================================
2
3Tags
4----
5scripting, JS, internal, treenode, general concept
6
7Parameters
8----------
9x
10
11General description
12-------------------
13Returns the inverse hyperbolic tangent of x.
14
15###
16
17Eval_arctanh = ->
18 push(cadr(p1))
19 Eval()
20 arctanh()
21
22arctanh = ->
23 d = 0.0
24 save()
25 p1 = pop()
26 if (car(p1) == symbol(TANH))
27 push(cadr(p1))
28 restore()
29 return
30
31 if (isdouble(p1))
32 d = p1.d
33 if (d < -1.0 || d > 1.0)
34 stop("arctanh function argument is not in the interval [-1,1]")
35 d = Math.log((1.0 + d) / (1.0 - d)) / 2.0
36 push_double(d)
37 restore()
38 return
39
40 if (iszero(p1))
41 push(zero)
42 restore()
43 return
44
45 push_symbol(ARCTANH)
46 push(p1)
47 list(2)
48 restore()
49
50
51