Skip to content

Commit 7c66302

Browse files
committed
Fix bug in equal3 for within() checks on strings
We need to return quickly if the arguments are identical and are not numbers, but need to avoid the identical-ness check for numbers so that we can return false in the case of within(1%<m>)(1%<s>, 1%<s>). The previous code had a logic bug where it skipped identical-ness checks on all within() calls, when it should only skip them for within() calls on numbers
1 parent a788536 commit 7c66302

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/js/base/runtime.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1987,8 +1987,11 @@ function (Namespace, jsnums, codePoint, util, exnStackParser, loader, seedrandom
19871987
}
19881988
curLeft = current.left;
19891989
curRight = current.right;
1990+
var isIdentical = thisRuntime.ffi.isEqual(identical3(curLeft, curRight))
19901991

1991-
if (!fromWithin && thisRuntime.ffi.isEqual(identical3(curLeft, curRight))) {
1992+
if (!fromWithin && isIdentical) {
1993+
continue;
1994+
} else if (isIdentical && !(isNumber(curLeft) || isNumber(curRight)) && !jsnums.isUnitnum(tol)) {
19921995
continue;
19931996
} else if (isNumber(curLeft) && isNumber(curRight)) {
19941997
if (!jsnums.checkUnit(jsnums.getUnit(curLeft), jsnums.getUnit(curRight))) {

0 commit comments

Comments
 (0)