diff options
-rw-r--r-- | generic/tclExecute.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 22c6cb5..79797f5 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8024,6 +8024,14 @@ ExecuteExtendedBinaryMathOp( } if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *)ptr1); + + if (w1 == 0) { + /* + * 0 % (non-zero) always yields remainder of 0. + */ + + return constants[0]; + } if (type2 != TCL_NUMBER_BIG) { Tcl_WideInt wQuotient, wRemainder; Tcl_GetWideIntFromObj(NULL, value2Ptr, &w2); |