| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 30 | 2 | 1 | 0.994 | StatementList[2] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 30 | 607 | Closure/closure/goog/math/integer.js |
| 2 | 30 | 648 | Closure/closure/goog/math/long.js |
| ||||
while (rem.greaterThanOrEqual(other)) {
// Approximate the result of division. This may be a little greater or
// smaller than the actual value.
var approx= Math.max(1, Math.floor(rem.toNumber( )/ other.toNumber( )));
// We will tweak the approximate result by changing it in the 48-th digit or
// the smallest non-fractional digit, whichever is larger.
var log2= Math.ceil(Math.log(approx)/ Math.LN2);
var delta= (log2<= 48)
? 1
: Math.pow(2, log2- 48);
// Decrease the approximation until it is smaller than the remainder. Note
// that if it is too large, the product overflows and is negative.
var approxRes= goog.math.Integer.fromNumber(approx);
var approxRem= approxRes.multiply(other);
while (approxRem.isNegative( )
|| approxRem.greaterThan(rem)) {
approx-= delta;
approxRes= goog.math.Integer.fromNumber(approx);
approxRem= approxRes.multiply(other);
}
// We know the answer can't be zero... and actually, zero would cause
// infinite recursion since we would make no progress.
if (approxRes.isZero( )){
approxRes= goog.math.Integer.ONE;
}
res= res.add(approxRes);
rem= rem.subtract(approxRem);
}
return res;
|
| ||||
while (rem.greaterThanOrEqual(other)) {
// Approximate the result of division. This may be a little greater or
// smaller than the actual value.
var approx= Math.max(1, Math.floor(rem.toNumber( )/ other.toNumber( )));
// We will tweak the approximate result by changing it in the 48-th digit or
// the smallest non-fractional digit, whichever is larger.
var log2= Math.ceil(Math.log(approx)/ Math.LN2);
var delta= (log2<= 48)
? 1
: Math.pow(2, log2- 48);
// Decrease the approximation until it is smaller than the remainder. Note
// that if it is too large, the product overflows and is negative.
var approxRes= goog.math.Long.fromNumber(approx);
var approxRem= approxRes.multiply(other);
while (approxRem.isNegative( )
|| approxRem.greaterThan(rem)) {
approx-= delta;
approxRes= goog.math.Long.fromNumber(approx);
approxRem= approxRes.multiply(other);
}
// We know the answer can't be zero... and actually, zero would cause
// infinite recursion since we would make no progress.
if (approxRes.isZero( )){
approxRes= goog.math.Long.ONE;
}
res= res.add(approxRes);
rem= rem.subtract(approxRem);
}
return res;
|
| |||
while (rem.greaterThanOrEqual(other))
{
// Approximate the result of division. This may be a little greater or
// smaller than the actual value.
var approx=Math.max(1,Math.floor(rem.toNumber( )/other.toNumber( )));
// We will tweak the approximate result by changing it in the 48-th digit or
// the smallest non-fractional digit, whichever is larger.
var log2=Math.ceil(Math.log(approx)/Math.LN2);
var delta=(log2<=48)
?1
:Math.pow(2,log2-48);
// Decrease the approximation until it is smaller than the remainder. Note
// that if it is too large, the product overflows and is negative.
var approxRes=goog.math. [[#variable60d04d40]].fromNumber(approx);
var approxRem=approxRes.multiply(other);
while (approxRem.isNegative( )
|| approxRem.greaterThan(rem))
{ approx-=delta;
approxRes=goog.math. [[#variable60d04d40]].fromNumber(approx);
approxRem=approxRes.multiply(other);
}
// We know the answer can't be zero... and actually, zero would cause
// infinite recursion since we would make no progress.
if (approxRes.isZero( ))
{ approxRes=goog.math. [[#variable60d04d40]].ONE;
}
res=res.add(approxRes);
rem=rem.subtract(approxRem);
}
return res;
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#60d04d40]] | Long |
| 1 | 2 | [[#60d04d40]] | Integer |