Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git] / arctanh.cpp
blob8001da7a6b166d2c96f0e8e210c2ab10218ae2fc
1 #include "stdafx.h"
2 #include "defs.h"
4 void
5 eval_arctanh(void)
7 push(cadr(p1));
8 eval();
9 arctanh();
12 void
13 arctanh(void)
15 double d;
16 save();
17 p1 = pop();
18 if (car(p1) == symbol(TANH)) {
19 push(cadr(p1));
20 restore();
21 return;
23 if (isdouble(p1)) {
24 d = p1->u.d;
25 if (d < -1.0 || d > 1.0)
26 stop("arctanh function argument is not in the interval [-1,1]");
27 d = log((1.0 + d) / (1.0 - d)) / 2.0;
28 push_double(d);
29 restore();
30 return;
32 if (iszero(p1)) {
33 push(zero);
34 restore();
35 return;
37 push_symbol(ARCTANH);
38 push(p1);
39 list(2);
40 restore();