Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git] / expcos.cpp
blob01f96b7bd5a5c2ba07f27a16c4b640a796a97ef3
1 // Do the exponential cosine function.
3 #include "stdafx.h"
4 #include "defs.h"
6 void
7 eval_expcos(void)
9 push(cadr(p1));
10 eval();
11 expcos();
14 void
15 expcos(void)
17 save();
19 p1 = pop();
21 push(imaginaryunit);
22 push(p1);
23 multiply();
24 exponential();
25 push_rational(1, 2);
26 multiply();
28 push(imaginaryunit);
29 negate();
30 push(p1);
31 multiply();
32 exponential();
33 push_rational(1, 2);
34 multiply();
36 add();
38 restore();
41 #if SELFTEST
43 static char *s[] = {
45 "expcos(x)",
46 "1/2*exp(-i*x)+1/2*exp(i*x)",
49 void
50 test_expcos(void)
52 test(__FILE__, s, sizeof s / sizeof (char *));
55 #endif