Skip to content

Commit

Permalink
don't convert booleans in numerical equality
Browse files Browse the repository at this point in the history
  • Loading branch information
dqnykamp committed Oct 25, 2021
1 parent 775c8e2 commit a05a672
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/math-expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76059,6 +76059,10 @@ const component_equals = function ({ expr, other, randomBindings,
var expr_evaluated = expr_f(bindings);
var other_evaluated = other_f(bindings);

if (typeof expr_evaluated === "boolean" || typeof other_evaluated === "boolean") {
return { out_of_bounds: true, always_zero: false };
}

var expr_abs = math$19.abs(expr_evaluated);
var other_abs = math$19.abs(other_evaluated);

Expand Down
4 changes: 4 additions & 0 deletions build/math-expressions_umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -76065,6 +76065,10 @@
var expr_evaluated = expr_f(bindings);
var other_evaluated = other_f(bindings);

if (typeof expr_evaluated === "boolean" || typeof other_evaluated === "boolean") {
return { out_of_bounds: true, always_zero: false };
}

var expr_abs = math$19.abs(expr_evaluated);
var other_abs = math$19.abs(other_evaluated);

Expand Down
4 changes: 4 additions & 0 deletions lib/expression/equality/numerical.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ const component_equals = function ({ expr, other, randomBindings,
var expr_evaluated = expr_f(bindings);
var other_evaluated = other_f(bindings);

if (typeof expr_evaluated === "boolean" || typeof other_evaluated === "boolean") {
return { out_of_bounds: true, always_zero: false };
}

var expr_abs = math.abs(expr_evaluated);
var other_abs = math.abs(other_evaluated);

Expand Down
1 change: 1 addition & 0 deletions spec/slow_math-expressions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ describe("expression", function () {
['5q <= 9z', '-5q <= -9z'],
['5q >= 9z', '-5q >= -9z'],
['10^(-30)', '2*10^(-30)'],
['0', 't=4'],
];

_.each(nonequivalences, function (nonequiv) {
Expand Down

0 comments on commit a05a672

Please sign in to comment.