@@ -118,7 +118,7 @@ var bigInt = (function (undefined) {
118
118
}
119
119
120
120
BigInteger . prototype . add = function ( v ) {
121
- var value , n = parseValue ( v ) ;
121
+ var n = parseValue ( v ) ;
122
122
if ( this . sign !== n . sign ) {
123
123
return this . subtract ( n . negate ( ) ) ;
124
124
}
@@ -177,7 +177,7 @@ var bigInt = (function (undefined) {
177
177
}
178
178
179
179
function subtractAny ( a , b , sign ) {
180
- var value , isSmall ;
180
+ var value ;
181
181
if ( compareAbs ( a , b ) >= 0 ) {
182
182
value = subtract ( a , b ) ;
183
183
} else {
@@ -326,7 +326,7 @@ var bigInt = (function (undefined) {
326
326
}
327
327
328
328
BigInteger . prototype . multiply = function ( v ) {
329
- var value , n = parseValue ( v ) ,
329
+ var n = parseValue ( v ) ,
330
330
a = this . value , b = n . value ,
331
331
sign = this . sign !== n . sign ,
332
332
abs ;
@@ -826,23 +826,24 @@ var bigInt = (function (undefined) {
826
826
BigInteger . prototype . modInv = function ( n ) {
827
827
var t = bigInt . zero , newT = bigInt . one , r = parseValue ( n ) , newR = this . abs ( ) , q , lastT , lastR ;
828
828
while ( ! newR . equals ( bigInt . zero ) ) {
829
- q = r . divide ( newR ) ;
830
- lastT = t ;
831
- lastR = r ;
832
- t = newT ;
833
- r = newR ;
834
- newT = lastT . subtract ( q . multiply ( newT ) ) ;
835
- newR = lastR . subtract ( q . multiply ( newR ) ) ;
829
+ q = r . divide ( newR ) ;
830
+ lastT = t ;
831
+ lastR = r ;
832
+ t = newT ;
833
+ r = newR ;
834
+ newT = lastT . subtract ( q . multiply ( newT ) ) ;
835
+ newR = lastR . subtract ( q . multiply ( newR ) ) ;
836
836
}
837
837
if ( ! r . equals ( 1 ) ) throw new Error ( this . toString ( ) + " and " + n . toString ( ) + " are not co-prime" ) ;
838
838
if ( t . compare ( 0 ) === - 1 ) {
839
- t = t . add ( n ) ;
839
+ t = t . add ( n ) ;
840
840
}
841
841
if ( this . isNegative ( ) ) {
842
842
return t . negate ( ) ;
843
843
}
844
844
return t ;
845
- }
845
+ } ;
846
+
846
847
SmallInteger . prototype . modInv = BigInteger . prototype . modInv ;
847
848
848
849
BigInteger . prototype . next = function ( ) {
@@ -1062,7 +1063,7 @@ var bigInt = (function (undefined) {
1062
1063
} ;
1063
1064
1064
1065
function parseBaseFromArray ( digits , base , isNegative ) {
1065
- var val = Integer [ 0 ] , pow = Integer [ 1 ] ;
1066
+ var val = Integer [ 0 ] , pow = Integer [ 1 ] , i ;
1066
1067
for ( i = digits . length - 1 ; i >= 0 ; i -- ) {
1067
1068
val = val . add ( digits [ i ] . times ( pow ) ) ;
1068
1069
pow = pow . times ( base ) ;
@@ -1215,7 +1216,7 @@ var bigInt = (function (undefined) {
1215
1216
1216
1217
Integer . fromArray = function ( digits , base , isNegative ) {
1217
1218
return parseBaseFromArray ( digits . map ( parseValue ) , parseValue ( base || 10 ) , isNegative ) ;
1218
- }
1219
+ } ;
1219
1220
1220
1221
return Integer ;
1221
1222
} ) ( ) ;
0 commit comments