[ 
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 via email to