if (!Double.isInfinite(mantissa) && mantissa != 0.0) {
// Make mantissa same sign so we only have one code path.
if (mantissa < 0) {
mantissa = -mantissa;
sign = -1;
}
// Increase value to hit lower range.
for (; mantissa < 0.5; mantissa *= 2.0, exponent -=1) { }
// Decrease value to hit upper range.
for (; mantissa >= 1.0; mantissa *= 0.5, exponent +=1) { }
}
if (mantissa != 0.0) {
if (mantissa < 0) {
mantissa = -mantissa;
sign = -1;
}
for (; mantissa < 0.5; mantissa *= 2.0, exponent -=1) { }
for (; mantissa >= 1.0; mantissa *= 0.5, exponent +=1) { }
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyMath.java
|
|
File path: /jruby-1.4.0/src/org/jruby/util/Numeric.java
|
Method name: RubyArray frexp(IRubyObject, IRubyObject)
|
|
Method name: double frexp(double, long[])
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (!Double.isInfinite(mantissa) && mantissa != 0.0) {↵ | | 1 | if (↵
|
2 | // Make mantissa same sign so we only have one code path.↵ | | 2 | mantissa != 0.0) {↵
|
3 | if (mantissa < 0) {↵ | | 3 | if (mantissa < 0) {↵
|
4 | mantissa = -mantissa;↵ | | 4 | mantissa = -mantissa;↵
|
5 | sign = -1;↵ | | 5 | sign = -1;↵
|
6 | }↵ | | 6 | }↵
|
|
7 | // Increase value to hit lower range.↵ | | |
|
8 | for (; mantissa < 0.5; mantissa *= 2.0, exponent -=1) { }↵ | | 7 | for (; mantissa < 0.5; mantissa *= 2.0, exponent -=1) { }↵
|
|
9 | // Decrease value to hit upper range. ↵ | | |
|
10 | for (; mantissa >= 1.0; mantissa *= 0.5, exponent +=1) { }↵ | | 8 | for (; mantissa >= 1.0; mantissa *= 0.5, exponent +=1) { }↵
|
11 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.6 |
Clones location | Clones are in different classes |
Number of node comparisons | 22 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | if (mantissa < 0) | | 4 | if (mantissa < 0) |
6 | | | 5 | |
7 | | | 6 | |
8 | for (; mantissa < 0.5; mantissa *= 2.0, exponent -= 1) | | 7 | for (; mantissa < 0.5; mantissa *= 2.0, exponent -= 1) |
9 | for (; mantissa >= 1.0; mantissa *= 0.5, exponent += 1) | | 8 | for (; mantissa >= 1.0; mantissa *= 0.5, exponent += 1) |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables sign, mantissa, exponent , while Clone fragment #2 returns variables exponent, sign, mantissa |