repo.or.cz
/
eigenmath-fx.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Little fix after the last commit (mostly a git fail)
[eigenmath-fx.git]
/
clock.cpp
blob
dca37fc2880610ef8d937b1e7a5a8b436b2ae2de
1
/* Convert complex z to clock form
2
3
Input: push z
4
5
Output: Result on stack
6
7
clock(z) = mag(z) * (-1) ^ (arg(z) / pi)
8
9
For example, clock(exp(i pi/3)) gives the result (-1)^(1/3)
10
*/
11
12
#include
"stdafx.h"
13
#include
"defs.h"
14
15
void
16
eval_clock
(
void
)
17
{
18
push
(
cadr
(
p1
));
19
eval
();
20
clockform
();
21
}
22
23
void
24
clockform
(
void
)
25
{
26
save
();
27
#if 1
28
p1
=
pop
();
29
push
(
p1
);
30
mag
();
31
push_integer
(-
1
);
32
push
(
p1
);
33
arg
();
34
push
(
symbol
(
PI
));
35
divide
();
36
power
();
37
multiply
();
38
#else
39
p1
=
pop
();
40
push
(
p1
);
41
mag
();
42
push
(
symbol
(
E
));
43
push
(
p1
);
44
arg
();
45
push
(
imaginaryunit
);
46
multiply
();
47
power
();
48
multiply
();
49
#endif
50
restore
();
51
}