diff options
author | mongo <andmarti@gmail.com> | 2017-03-09 17:27:20 -0300 |
---|---|---|
committer | mongo <andmarti@gmail.com> | 2017-03-09 17:27:20 -0300 |
commit | e3f46c2b3d98fdc0e24864b04d06a0dab2c326d3 (patch) | |
tree | 1b7c4529463b567a39554ee3c013fd54c22721c0 /src/interp.c | |
parent | e945db9b9d961c9910f4ed6ccd7501f34d7a7658 (diff) |
fix in dolmax and dolmin
Diffstat (limited to 'src/interp.c')
-rw-r--r-- | src/interp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/interp.c b/src/interp.c index 25b2004..dcb9fa3 100644 --- a/src/interp.c +++ b/src/interp.c @@ -645,8 +645,10 @@ double dolmax(struct enode * ep) { cellerror = CELLOK; for (p = ep; p; p = p->e.o.left) { v = eval(NULL, p->e.o.right); - if ( !count || v > maxval) maxval = v; - count++; + if ( !count || v > maxval) { + maxval = v; + count++; + } } if (count) return maxval; else return (double)0; @@ -661,8 +663,10 @@ double dolmin(struct enode * ep) { cellerror = CELLOK; for (p = ep; p; p = p->e.o.left) { v = eval(NULL, p->e.o.right); - if ( !count || v < minval) minval = v; - count++; + if ( !count || v < minval) { + minval = v; + count++; + } } if (count) return minval; else return (double)0; |