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 d318950
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "math-expressions",
"description": "Perform basic equality testing and symbolic computations on mathematical expressions involving transcendental functions",
"version": "2.0.0-alpha26",
"version": "2.0.0-alpha27",
"author": {
"name": "Jim Fowler",
"email": "kisonecat@gmail.com",
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 d318950

Please sign in to comment.