[jira] [Created] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
Dead code in FastMath.pow(double, double) and some improvement in test coverage
-------------------------------------------------------------------------------

                 Key: MATH-658
                 URL: https://issues.apache.org/jira/browse/MATH-658
             Project: Commons Math
          Issue Type: Improvement
            Reporter: Yannick TANGUY
            Priority: Minor
             Fix For: 3.0


This issue concerns the FastMath class and its test class.
I don't know how to attach source code to an issue : sorry if it's not easy to read...

(1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
                if (y < 0 && y == yi && (yi & 1) == 1) {
                    return Double.NEGATIVE_INFINITY;
                }

                // this block is never used -> to be suppressed
                if (y < 0 && y == yi && (yi & 1) == 1) {
                    return -0.0;
                }

                if (y > 0 && y == yi && (yi & 1) == 1) {
                    return -0.0;
                }


(2) To obtain better code coverage, we added some tests case in FastMathTest.java :

    /**
     * Added test for log1p
     */
    @Test
    public void testLog1pSpecialCases() {
        double x;
       
    x = FastMath.log1p(-1.0);
        if (x != Double.NEGATIVE_INFINITY)
            throw new RuntimeException("Log1p of -1 should be -infinity");

    }

  public void testPowSpecialCases() {
 

  // [ ... ]


       // Added tests for a 100% coverage
             
        x = FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN);
        if (x == x)
            throw new RuntimeException("pow(+Inf, NaN) should be NaN");
       
        x = FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN);
        if (x == x)
            throw new RuntimeException("pow(+Inf, NaN) should be NaN");
       
        x = FastMath.pow(1.0, Double.POSITIVE_INFINITY);
        if (x == x)
            throw new RuntimeException("pow(1.0, +Inf) should be NaN");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, Double.NaN);
        if (x == x)
            throw new RuntimeException("pow(-Inf, NaN) should be NaN");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, -1.0);
        if (x != -0.0)
            throw new RuntimeException("pow(-Inf, -1.0) should be 0.0");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, -2.0);
        if (x != 0.0)
            throw new RuntimeException("pow(-Inf, -2.0) should be 0.0");
   
        x = FastMath.pow(Double.NEGATIVE_INFINITY, 1.0);
        if (x != Double.NEGATIVE_INFINITY)
            throw new RuntimeException("pow(-Inf, 1.0) should be -Inf");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, 2.0);
        if (x != Double.POSITIVE_INFINITY)
            throw new RuntimeException("pow(-Inf, 2.0) should be +Inf");

        x = FastMath.pow(1.0, Double.NEGATIVE_INFINITY);
        if (x == x)
           throw new RuntimeException("pow(1.0, -Inf) should be NaN");

   }
     
    /**
     * Added tests for a 100% coverage of acos().
     */
    @Test
    public void testAcosSpecialCases() {
    double x;

    x = FastMath.acos(Double.NaN);
    if (x == x)
    throw new RuntimeException("acos(NaN) should NaN");

    x = FastMath.acos(-1.1);
    if (x == x)
    throw new RuntimeException("acos(-1.1) should NaN");
   
    x = FastMath.acos(1.1);
    if (x == x)
    throw new RuntimeException("acos(-1.1) should NaN");
   
    assertEquals(FastMath.acos(-1.0), FastMath.PI, Double.MIN_VALUE);

    assertEquals(FastMath.acos(1.0), 0.0, Double.MIN_VALUE);

    assertEquals(FastMath.acos(0.0), FastMath.PI / 2.0, Double.MIN_VALUE);
    }
   
    /**
     * Added tests for a 100% coverage of asin().
     */
    @Test
    public void testAsinSpecialCases() {
    double x;

    x = FastMath.asin(Double.NaN);
    if (x == x)
    throw new RuntimeException("asin(NaN) should NaN");

    x = FastMath.asin(-1.1);
    if (x == x)
    throw new RuntimeException("asin(-1.1) should NaN");
   
    x = FastMath.asin(1.1);
    if (x == x)
    throw new RuntimeException("asin(-1.1) should NaN");
   
    assertEquals(FastMath.asin(1.0), FastMath.PI / 2.0, Double.MIN_VALUE);

    assertEquals(FastMath.asin(-1.0), -FastMath.PI / 2.0, Double.MIN_VALUE);

    assertEquals(FastMath.asin(0.0), 0.0, Double.MIN_VALUE);
    }
   
 

 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment: FastMathTest.java

This class contains some new tests to improve test coverage

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMathTest.java
>
>
> This issue concerns the FastMath class and its test class.
> I don't know how to attach source code to an issue : sorry if it's not easy to read...
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java :
>     /**
>      * Added test for log1p
>      */
>     @Test
>     public void testLog1pSpecialCases() {
>         double x;
>        
>     x = FastMath.log1p(-1.0);
>         if (x != Double.NEGATIVE_INFINITY)
>             throw new RuntimeException("Log1p of -1 should be -infinity");
>     }
>   public void testPowSpecialCases() {
>  
>   // [ ... ]
>        // Added tests for a 100% coverage
>              
>         x = FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN);
>         if (x == x)
>             throw new RuntimeException("pow(+Inf, NaN) should be NaN");
>        
>         x = FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN);
>         if (x == x)
>             throw new RuntimeException("pow(+Inf, NaN) should be NaN");
>        
>         x = FastMath.pow(1.0, Double.POSITIVE_INFINITY);
>         if (x == x)
>             throw new RuntimeException("pow(1.0, +Inf) should be NaN");
>        
>         x = FastMath.pow(Double.NEGATIVE_INFINITY, Double.NaN);
>         if (x == x)
>             throw new RuntimeException("pow(-Inf, NaN) should be NaN");
>        
>         x = FastMath.pow(Double.NEGATIVE_INFINITY, -1.0);
>         if (x != -0.0)
>             throw new RuntimeException("pow(-Inf, -1.0) should be 0.0");
>        
>         x = FastMath.pow(Double.NEGATIVE_INFINITY, -2.0);
>         if (x != 0.0)
>             throw new RuntimeException("pow(-Inf, -2.0) should be 0.0");
>    
>         x = FastMath.pow(Double.NEGATIVE_INFINITY, 1.0);
>         if (x != Double.NEGATIVE_INFINITY)
>             throw new RuntimeException("pow(-Inf, 1.0) should be -Inf");
>        
>         x = FastMath.pow(Double.NEGATIVE_INFINITY, 2.0);
>         if (x != Double.POSITIVE_INFINITY)
>             throw new RuntimeException("pow(-Inf, 2.0) should be +Inf");
>         x = FastMath.pow(1.0, Double.NEGATIVE_INFINITY);
>         if (x == x)
>            throw new RuntimeException("pow(1.0, -Inf) should be NaN");
>    }
>      
>     /**
>      * Added tests for a 100% coverage of acos().
>      */
>     @Test
>     public void testAcosSpecialCases() {
>     double x;
>     x = FastMath.acos(Double.NaN);
>     if (x == x)
>     throw new RuntimeException("acos(NaN) should NaN");
>     x = FastMath.acos(-1.1);
>     if (x == x)
>     throw new RuntimeException("acos(-1.1) should NaN");
>    
>     x = FastMath.acos(1.1);
>     if (x == x)
>     throw new RuntimeException("acos(-1.1) should NaN");
>    
>     assertEquals(FastMath.acos(-1.0), FastMath.PI, Double.MIN_VALUE);
>     assertEquals(FastMath.acos(1.0), 0.0, Double.MIN_VALUE);
>     assertEquals(FastMath.acos(0.0), FastMath.PI / 2.0, Double.MIN_VALUE);
>     }
>    
>     /**
>      * Added tests for a 100% coverage of asin().
>      */
>     @Test
>     public void testAsinSpecialCases() {
>     double x;
>     x = FastMath.asin(Double.NaN);
>     if (x == x)
>     throw new RuntimeException("asin(NaN) should NaN");
>     x = FastMath.asin(-1.1);
>     if (x == x)
>     throw new RuntimeException("asin(-1.1) should NaN");
>    
>     x = FastMath.asin(1.1);
>     if (x == x)
>     throw new RuntimeException("asin(-1.1) should NaN");
>    
>     assertEquals(FastMath.asin(1.0), FastMath.PI / 2.0, Double.MIN_VALUE);
>     assertEquals(FastMath.asin(-1.0), -FastMath.PI / 2.0, Double.MIN_VALUE);
>     assertEquals(FastMath.asin(0.0), 0.0, Double.MIN_VALUE);
>     }
>    
>  
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Description:
This issue concerns the FastMath class and its test class.

(1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
                if (y < 0 && y == yi && (yi & 1) == 1) {
                    return Double.NEGATIVE_INFINITY;
                }

                // this block is never used -> to be suppressed
                if (y < 0 && y == yi && (yi & 1) == 1) {
                    return -0.0;
                }

                if (y > 0 && y == yi && (yi & 1) == 1) {
                    return -0.0;
                }


(2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
- Added test for log1p
- Added tests in testPowSpecialCases()
- Added tests for a 100% coverage of acos().
- Added tests for a 100% coverage of asin().


  was:
This issue concerns the FastMath class and its test class.
I don't know how to attach source code to an issue : sorry if it's not easy to read...

(1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
                if (y < 0 && y == yi && (yi & 1) == 1) {
                    return Double.NEGATIVE_INFINITY;
                }

                // this block is never used -> to be suppressed
                if (y < 0 && y == yi && (yi & 1) == 1) {
                    return -0.0;
                }

                if (y > 0 && y == yi && (yi & 1) == 1) {
                    return -0.0;
                }


(2) To obtain better code coverage, we added some tests case in FastMathTest.java :

    /**
     * Added test for log1p
     */
    @Test
    public void testLog1pSpecialCases() {
        double x;
       
    x = FastMath.log1p(-1.0);
        if (x != Double.NEGATIVE_INFINITY)
            throw new RuntimeException("Log1p of -1 should be -infinity");

    }

  public void testPowSpecialCases() {
 

  // [ ... ]


       // Added tests for a 100% coverage
             
        x = FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN);
        if (x == x)
            throw new RuntimeException("pow(+Inf, NaN) should be NaN");
       
        x = FastMath.pow(Double.POSITIVE_INFINITY, Double.NaN);
        if (x == x)
            throw new RuntimeException("pow(+Inf, NaN) should be NaN");
       
        x = FastMath.pow(1.0, Double.POSITIVE_INFINITY);
        if (x == x)
            throw new RuntimeException("pow(1.0, +Inf) should be NaN");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, Double.NaN);
        if (x == x)
            throw new RuntimeException("pow(-Inf, NaN) should be NaN");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, -1.0);
        if (x != -0.0)
            throw new RuntimeException("pow(-Inf, -1.0) should be 0.0");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, -2.0);
        if (x != 0.0)
            throw new RuntimeException("pow(-Inf, -2.0) should be 0.0");
   
        x = FastMath.pow(Double.NEGATIVE_INFINITY, 1.0);
        if (x != Double.NEGATIVE_INFINITY)
            throw new RuntimeException("pow(-Inf, 1.0) should be -Inf");
       
        x = FastMath.pow(Double.NEGATIVE_INFINITY, 2.0);
        if (x != Double.POSITIVE_INFINITY)
            throw new RuntimeException("pow(-Inf, 2.0) should be +Inf");

        x = FastMath.pow(1.0, Double.NEGATIVE_INFINITY);
        if (x == x)
           throw new RuntimeException("pow(1.0, -Inf) should be NaN");

   }
     
    /**
     * Added tests for a 100% coverage of acos().
     */
    @Test
    public void testAcosSpecialCases() {
    double x;

    x = FastMath.acos(Double.NaN);
    if (x == x)
    throw new RuntimeException("acos(NaN) should NaN");

    x = FastMath.acos(-1.1);
    if (x == x)
    throw new RuntimeException("acos(-1.1) should NaN");
   
    x = FastMath.acos(1.1);
    if (x == x)
    throw new RuntimeException("acos(-1.1) should NaN");
   
    assertEquals(FastMath.acos(-1.0), FastMath.PI, Double.MIN_VALUE);

    assertEquals(FastMath.acos(1.0), 0.0, Double.MIN_VALUE);

    assertEquals(FastMath.acos(0.0), FastMath.PI / 2.0, Double.MIN_VALUE);
    }
   
    /**
     * Added tests for a 100% coverage of asin().
     */
    @Test
    public void testAsinSpecialCases() {
    double x;

    x = FastMath.asin(Double.NaN);
    if (x == x)
    throw new RuntimeException("asin(NaN) should NaN");

    x = FastMath.asin(-1.1);
    if (x == x)
    throw new RuntimeException("asin(-1.1) should NaN");
   
    x = FastMath.asin(1.1);
    if (x == x)
    throw new RuntimeException("asin(-1.1) should NaN");
   
    assertEquals(FastMath.asin(1.0), FastMath.PI / 2.0, Double.MIN_VALUE);

    assertEquals(FastMath.asin(-1.0), -FastMath.PI / 2.0, Double.MIN_VALUE);

    assertEquals(FastMath.asin(0.0), 0.0, Double.MIN_VALUE);
    }
   
 

 


> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMathTest.java
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13098316#comment-13098316 ]

Luc Maisonobe commented on MATH-658:
------------------------------------

Could you provide the patch as a unified diff file with respect to current development tree so we can review it ?

Thanks

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMathTest.java
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment: FastMathTest.java.diff
                FastMath.java.diff

Is that the right format ?

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100397#comment-13100397 ]

Sebb commented on MATH-658:
---------------------------

The body format (3rd line onwards) is OK, but the header lines are incorrect.
They should look something like:

{code}
Index: src/main/java/org/apache/commons/math/util/FastMath.java
===================================================================
--- src/main/java/org/apache/commons/math/util/FastMath.java (revision 1166437)
+++ src/main/java/org/apache/commons/math/util/FastMath.java (working copy)
{code}

This was created by updating the file in an SVN working copy and then creating the patch (I used Eclipse, specifying project-relative mode, but svn diff would produce much the same output).

Your patch has completely different names and paths for the input and output files:

{code}
--- D:/DOCUME~1/tanguyy/LOCALS~1/Temp/FastMath.java-revBASE.svn000.tmp.java       jeu. sept.  8 16:28:36 2011
+++ D:/DONNEES/ATELIER_JAVA/workspace/Commons-Math_Trunk/src/main/java/org/apache/commons/math/util/FastMath.java       jeu. sept.  8 16:10:02 2011
{code}

This means it's impossible to apply the patch automatically.

However, it's not too difficult to fix the header lines, e.g. in the above case to:

{code}
--- FastMath.java       jeu. sept.  8 16:28:36 2011
+++ FastMath.java       jeu. sept.  8 16:10:02 2011
{code}

and the patch can then be applied in the appropriate directory.

No need to resubmit these particular patches, but if you submit any more please use the proper unified diff format relative to the top-level project directory, so paths start with src/.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100405#comment-13100405 ]

Yannick TANGUY commented on MATH-658:
-------------------------------------

Ok, thanks for the tip. I'll do it next time.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved MATH-658.
-----------------------

    Resolution: Fixed

Patches applied.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100627#comment-13100627 ]

Luc Maisonobe commented on MATH-658:
------------------------------------

Also try to avoid static imports (and even more static imports with * at the end).
I have fixed them.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100734#comment-13100734 ]

Sebb commented on MATH-658:
---------------------------

Thanks - I did see the wildcard import, but left it as it is test code so not so important.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13100746#comment-13100746 ]

Sebb commented on MATH-658:
---------------------------

Also, just noticed some tab characters in the test class patch which I have just fixed. We don't allow tabs.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Reopened] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe reopened MATH-658:
--------------------------------


I have looked at the added tests.
The way they are performed is really not clean.
Could you replace all instances of:
{code}
x = FastMath.someMethod(parameter);
if (x != Double.NEGATIVE_INFINITY)
  throw new RuntimeException("xxx should be -Inf");
{code}

by
{code}
Assert.assertTrue(Double.isInf(FastMath.someMethod(parameter)));
{code}

These are Junit tests so we need to get errors that are counted by the Junit framework, not exceptions that stop the test and whose messages are not directed in the same media.

Also instead of (x == x) or (x != x), you could use the more easy to understand method Double.isNaN(x). Most people would not understand why (x == x) could fail.

Could you set up a new patch, using the current state of the FastMathTest file as committed by Sebb ?

Thanks a lot

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13101186#comment-13101186 ]

Yannick TANGUY commented on MATH-658:
-------------------------------------

Ok, here is a new patch for FastMathTest.java : I replaced the new tests and also checked and transformed some former ones that also used exceptions.


> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment: FastMathTest.java.diff

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java, FastMathTest.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment:     (was: FastMathTest.java)

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment:     (was: FastMathTest.java.diff)

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13101191#comment-13101191 ]

Yannick TANGUY commented on MATH-658:
-------------------------------------

Sorry, I made the same mistake with Tortoise SVN and the header lines are still incorrect : how do you produce a patch with Eclipse ?

-> I'll try to correct it this afternoon.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

    [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13101190#comment-13101190 ]

Yannick TANGUY commented on MATH-658:
-------------------------------------

Sorry, I made the same mistake with Tortoise SVN and the header lines are still incorrect : how do you produce a patch with Eclipse ?

-> I'll try to correct it this afternoon.

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment: FastMathTest.java.diff

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (MATH-658) Dead code in FastMath.pow(double, double) and some improvement in test coverage

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

     [ https://issues.apache.org/jira/browse/MATH-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick TANGUY updated MATH-658:
--------------------------------

    Attachment:     (was: FastMathTest.java.diff)

> Dead code in FastMath.pow(double, double) and some improvement in test coverage
> -------------------------------------------------------------------------------
>
>                 Key: MATH-658
>                 URL: https://issues.apache.org/jira/browse/MATH-658
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Yannick TANGUY
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: FastMath.java.diff, FastMathTest.java.diff
>
>
> This issue concerns the FastMath class and its test class.
> (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return Double.NEGATIVE_INFINITY;
>                 }
>                 // this block is never used -> to be suppressed
>                 if (y < 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
>                 if (y > 0 && y == yi && (yi & 1) == 1) {
>                     return -0.0;
>                 }
> (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)
> - Added test for log1p
> - Added tests in testPowSpecialCases()
> - Added tests for a 100% coverage of acos().
> - Added tests for a 100% coverage of asin().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
12