about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-12-18 16:56:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-12-18 16:56:26 +0000
commit24dd6fcd97da2f322f31876de0126334722148d3 (patch)
tree42ba9bdb920c34f4e727700c0db45b72459e2972 /Src/builtin.c
parent7c2e738536943aa80a66bd1b62675fb8ea83e345 (diff)
downloadzsh-24dd6fcd97da2f322f31876de0126334722148d3.tar.gz
zsh-24dd6fcd97da2f322f31876de0126334722148d3.tar.xz
zsh-24dd6fcd97da2f322f31876de0126334722148d3.zip
18013: Handle test of (( float == 0.0)) properly
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index cb7c82052..b175bcae9 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4097,13 +4097,14 @@ bin_ttyctl(char *name, char **argv, char *ops, int func)
 int
 bin_let(char *name, char **argv, char *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  *