Comparing version 0.0.2 to 0.1.0
22
num.js
@@ -176,2 +176,24 @@ var int = require('int'); | ||
Num.mod = function(a, b) { | ||
a = ensure_num(a); | ||
b = ensure_num(b); | ||
var prec_a = a._precision; | ||
var prec_b = b._precision; | ||
var a = a._int; | ||
var b = b._int; | ||
while (prec_a < prec_b) { | ||
a = a.mul(10); | ||
prec_a += 1; | ||
} | ||
while (prec_b < prec_a) { | ||
b = b.mul(10); | ||
prec_b += 1; | ||
} | ||
return Num(a.mod(b), prec_a); | ||
}; | ||
/// returns < 0 if a < b, 0 if a == b, > 0 if a > b | ||
@@ -178,0 +200,0 @@ Num.cmp = function(a, b) { |
@@ -5,3 +5,3 @@ { | ||
"description": "arbitrary precision integer and decimal library in pure javascript", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
13865
16
346