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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in different classes
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    5
    if (mantissa < 0)
    4
    if (mantissa < 0)
    6
    mantissa = -mantissa;
    5
    mantissa = -mantissa;
    7
    sign = -1;
    6
    sign = -1;
    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
    1Clone fragment #1 returns variables sign, mantissa, exponent , while Clone fragment #2 returns variables exponent, sign, mantissa