1 | ### arctanh =====================================================================
|
2 |
|
3 | Tags
|
4 | ----
|
5 | scripting, JS, internal, treenode, general concept
|
6 |
|
7 | Parameters
|
8 | ----------
|
9 | x
|
10 |
|
11 | General description
|
12 | -------------------
|
13 | Returns the inverse hyperbolic tangent of x.
|
14 |
|
15 | ###
|
16 |
|
17 | Eval_arctanh = ->
|
18 | push(cadr(p1))
|
19 | Eval()
|
20 | arctanh()
|
21 |
|
22 | arctanh = ->
|
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 |
|