Skip to content

Commit

Permalink
Fix amusing bug, discovered by my son J, that caused 1/(0-4) to be 1/…
Browse files Browse the repository at this point in the history
…-4 ("one negative-fourth") rather than -1/4.
  • Loading branch information
jorendorff committed Aug 21, 2013
1 parent 60eb90b commit dd0deaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion calculator-backends.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function gcd(a, b) {
function Fraction(n, d) {
if (d === undefined)
d = new BigInteger(1);
var x = gcd(n, d);
var x = gcd(n.abs(), d);
this.n = n.divide(x);
this.d = d.divide(x);
}
Expand Down

0 comments on commit dd0deaf

Please sign in to comment.