Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Src/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -7503,7 +7503,7 @@ bin_let(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int func))
/* Errors in math evaluation in let are non-fatal. */
errflag &= ~ERRFLAG_ERROR;
/* should test for fabs(val.u.d) < epsilon? */
return (val.type == MN_INTEGER) ? val.u.l == 0 : val.u.d == 0.0;
return (val.type == MN_INTEGER) ? val.u.l == 0 : (val.u.d == 0.0 || isnan(val.u.d));
}

/* umask command. umask may be specified as octal digits, or in the *
Expand Down
4 changes: 4 additions & 0 deletions Test/C01arith.ztst
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@
0:NaN results
>NaN NaN NaN

let "0.0 / 0.0"; echo $?
0:let exit status for NaN (0.0/0.0)
>1

(( 3 / 0 ))
2:Integer division by zero
?(eval):1: division by zero
Expand Down