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]
/
sgn.cpp
blob
5bce465bd6bd6bc42c13c8973788a701b31ffbb4
1
#include
"defs.h"
2
3
void
4
eval_sgn
(
void
)
5
{
6
push
(
cadr
(
p1
));
7
eval
();
8
sgn
();
9
}
10
11
void
12
sgn
(
void
)
13
{
14
save
();
15
16
p1
=
pop
();
17
18
if
(!
isnum
(
p1
)) {
19
push_symbol
(
SGN
);
20
push
(
p1
);
21
list
(
2
);
22
}
else if
(
iszero
(
p1
))
23
push_integer
(
0
);
24
else if
(
isnegativenumber
(
p1
))
25
push_integer
(-
1
);
26
else
27
push_integer
(
1
);
28
29
restore
();
30
}