A (very) few UI improvements
[eigenmath-fx.git] / sinh.cpp
blob2ab0c43217345245410b3bc490c376e4d9e98175
1 // exp(x) - exp(-x)
2 // sinh(x) = ----------------
3 // 2
5 #include "stdafx.h"
6 #include "defs.h"
8 void
9 eval_sinh(void)
11 push(cadr(p1));
12 eval();
13 ysinh();
16 void
17 ysinh(void)
19 save();
20 yysinh();
21 restore();
24 void
25 yysinh(void)
27 double d;
28 p1 = pop();
29 if (car(p1) == symbol(ARCSINH)) {
30 push(cadr(p1));
31 return;
33 if (isdouble(p1)) {
34 d = sinh(p1->u.d);
35 if (fabs(d) < 1e-10)
36 d = 0.0;
37 push_double(d);
38 return;
40 if (iszero(p1)) {
41 push(zero);
42 return;
44 push_symbol(SINH);
45 push(p1);
46 list(2);
49 #if SELFTEST
51 static char *s[] = {
53 "sinh(x)",
54 "sinh(x)",
56 "sinh(0)",
57 "0",
59 "sinh(arcsinh(x))",
60 "x",
63 void
64 test_sinh(void)
66 test(__FILE__, s, sizeof s / sizeof (char *));
69 #endif