Skip to content

Commit a05a672

Browse files
committed
don't convert booleans in numerical equality
1 parent 775c8e2 commit a05a672

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

build/math-expressions.js

+4
Original file line numberDiff line numberDiff line change
@@ -76059,6 +76059,10 @@ const component_equals = function ({ expr, other, randomBindings,
7605976059
var expr_evaluated = expr_f(bindings);
7606076060
var other_evaluated = other_f(bindings);
7606176061

76062+
if (typeof expr_evaluated === "boolean" || typeof other_evaluated === "boolean") {
76063+
return { out_of_bounds: true, always_zero: false };
76064+
}
76065+
7606276066
var expr_abs = math$19.abs(expr_evaluated);
7606376067
var other_abs = math$19.abs(other_evaluated);
7606476068

build/math-expressions_umd.js

+4
Original file line numberDiff line numberDiff line change
@@ -76065,6 +76065,10 @@
7606576065
var expr_evaluated = expr_f(bindings);
7606676066
var other_evaluated = other_f(bindings);
7606776067

76068+
if (typeof expr_evaluated === "boolean" || typeof other_evaluated === "boolean") {
76069+
return { out_of_bounds: true, always_zero: false };
76070+
}
76071+
7606876072
var expr_abs = math$19.abs(expr_evaluated);
7606976073
var other_abs = math$19.abs(other_evaluated);
7607076074

lib/expression/equality/numerical.js

+4
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ const component_equals = function ({ expr, other, randomBindings,
379379
var expr_evaluated = expr_f(bindings);
380380
var other_evaluated = other_f(bindings);
381381

382+
if (typeof expr_evaluated === "boolean" || typeof other_evaluated === "boolean") {
383+
return { out_of_bounds: true, always_zero: false };
384+
}
385+
382386
var expr_abs = math.abs(expr_evaluated);
383387
var other_abs = math.abs(other_evaluated);
384388

spec/slow_math-expressions.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ describe("expression", function () {
311311
['5q <= 9z', '-5q <= -9z'],
312312
['5q >= 9z', '-5q >= -9z'],
313313
['10^(-30)', '2*10^(-30)'],
314+
['0', 't=4'],
314315
];
315316

316317
_.each(nonequivalences, function (nonequiv) {

0 commit comments

Comments
 (0)