Comparing version
22
index.js
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var Rat, bigInt; | ||
var Integer, Rat; | ||
bigInt = require("big-integer"); | ||
Integer = require("./Integer"); | ||
@@ -15,4 +15,4 @@ Rat = (function() { | ||
} | ||
this.num = new bigInt(num); | ||
this.denom = new bigInt(denom); | ||
this.num = new Integer(num); | ||
this.denom = new Integer(denom); | ||
this.normalize(); | ||
@@ -27,17 +27,17 @@ } | ||
if (this.num.isZero()) { | ||
this.denom = new bigInt(1); | ||
this.denom = new Integer(1); | ||
return this; | ||
} | ||
if (!this.denom.isPositive()) { | ||
this.num = bigInt.zero.minus(this.num); | ||
this.denom = bigInt.zero.minus(this.denom); | ||
this.num = Integer.zero.minus(this.num); | ||
this.denom = Integer.zero.minus(this.denom); | ||
return this.normalize(); | ||
} | ||
if (!this.num.isPositive()) { | ||
this.num = bigInt.zero.minus(this.num); | ||
this.num = Integer.zero.minus(this.num); | ||
this.normalize(); | ||
this.num = bigInt.zero.minus(this.num); | ||
this.num = Integer.zero.minus(this.num); | ||
return this; | ||
} | ||
g = bigInt.gcd(this.num, this.denom); | ||
g = Integer.gcd(this.num, this.denom); | ||
this.num = this.num.divide(g); | ||
@@ -71,3 +71,3 @@ this.denom = this.denom.divide(g); | ||
if (Y == null) { | ||
return new Rat(bigInt.zero.minus(X.num), X.denom); | ||
return new Rat(Integer.zero.minus(X.num), X.denom); | ||
} | ||
@@ -74,0 +74,0 @@ if (!(Y instanceof Rat)) { |
{ | ||
"name": "rat.js", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Rational numbers (fractions) in JS, with +, -, *, and /", | ||
"main": "index.js", | ||
"dependencies": { | ||
"big-integer": "^1.5.6" | ||
"BigInt": "^5.5.3" | ||
}, | ||
@@ -17,4 +17,4 @@ "devDependencies": { | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fraczak/rat.js.git" | ||
"type": "git", | ||
"url": "https://github.com/fraczak/rat.js.git" | ||
}, | ||
@@ -21,0 +21,0 @@ "author": "Wojciech Fraczak <fraczak@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
10813
34.42%7
40%1
-50%26
Infinity%151
-8.48%+ Added
+ Added
- Removed
- Removed