summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c7
-rw-r--r--Src/exec.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index f9f65e961..530bba8c8 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4759,13 +4759,14 @@ bin_ttyctl(char *name, char **argv, Options ops, int func)
int
bin_let(char *name, char **argv, Options ops, int func)
{
- zlong val = 0;
+ mnumber val = zero_mnumber;
while (*argv)
- val = mathevali(*argv++);
+ val = matheval(*argv++);
/* Errors in math evaluation in let are non-fatal. */
errflag = 0;
- return !val;
+ /* should test for fabs(val.u.d) < epsilon? */
+ return (val.type == MN_INTEGER) ? val.u.l == 0 : val.u.d == 0.0;
}
/* umask command. umask may be specified as octal digits, or in the *
diff --git a/Src/exec.c b/Src/exec.c
index 76ca437f4..978470251 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3087,7 +3087,7 @@ static int
execarith(Estate state, int do_exec)
{
char *e;
- zlong val = 0;
+ mnumber val = zero_mnumber;
int htok = 0;
if (isset(XTRACE)) {
@@ -3101,7 +3101,7 @@ execarith(Estate state, int do_exec)
if (isset(XTRACE))
fprintf(xtrerr, " %s", e);
- val = mathevali(e);
+ val = matheval(e);
cmdpop();
@@ -3110,7 +3110,8 @@ execarith(Estate state, int do_exec)
fflush(xtrerr);
}
errflag = 0;
- return !val;
+ /* should test for fabs(val.u.d) < epsilon? */
+ return (val.type == MN_INTEGER) ? val.u.l == 0 : val.u.d == 0.0;
}
/* perform time ... command */