Soft'N'Design Software
/
projects
/
calc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
correct push
[calc.git]
/
stack.c
diff --git
a/stack.c
b/stack.c
index 829f8aa6483f9357861680931a49a54d0a045799..a355fa5e3281b2fc34d1c3460c43701d776c99a2 100644
(file)
--- a/
stack.c
+++ b/
stack.c
@@
-1,3
+1,4
@@
+#include <math.h>
#include <stdio.h>
#include "debug.h"
#include <stdio.h>
#include "debug.h"
@@
-30,7
+31,14
@@
double pop ()
double push (double val)
{
double push (double val)
{
- return push_tab (stack, -1, val);
+ double ret = NAN;
+ if (stack) {
+ ret = push_tab (stack, -1, val);
+ } else {
+ stack = resize_tab (stack, 1);
+ ret = set_tab (stack, 1, val);
+ }
+ return ret;
}
double put (int n, double val)
}
double put (int n, double val)