commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] [Resolved] (MATH-553) Bug in class# org.apache.commons.math.dfp.Dfp / org.apache.commons.math.linear.RealVectorwith reproducible JUnit test
Date Sun, 03 Apr 2011 19:18:05 GMT


Luc Maisonobe resolved MATH-553.

    Resolution: Not A Problem

Apart from Sebb comments on COLLECTIONS-374, here are a few additional comments for math.

The test is targeted at 2.2 which will probably be the last version in the 2.X series. In
this series, we used a mix of Junit 3 and Junit 4 tests. The current code in the trunk for
3.0 has completely switched to Junit 4. It would be nice to have Junit 4 tests rather than
Junit 3 tests.

In math, we use a lot of double primitive variables. What about replacing the java.lang.double
objects to primitive doubles (and similarly for other primitives types), this would help read
the tests.

The failing test for var87.equals(var87) is a false positive. This is a very specific feature
of real numbers, some special numbers called NaN (which stands for Not A Number) are equals
to nothing, including themselves. So var87.equals(var87) must return false for a NaN. In fact,
all boolean predicates on NaN must fail, so if you have two NaNs a and b, the predicates a
== b, a != b, a < b, a <= b, a > b, a >= b are ALL false!

This is very specific and I don't expect an automatic tool to be aware of this. Also having
a way to configure the tool for such a rare case would really be overkill.

So this bug is in fact not a bug.

> Bug in class# org.apache.commons.math.dfp.Dfp / org.apache.commons.math.linear.RealVectorwith
reproducible JUnit test
> ---------------------------------------------------------------------------------------------------------------------
>                 Key: MATH-553
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: jdk 1.6
>            Reporter: Sai Zhang
>         Attachments:
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Math as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not?
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the quality of generated code comments?
> From the perspective of developers who are familiar with the code,
> is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing from the
> perspective of developers?
> Particularly when the automatically-generated tests
> are often long.
> Your suggestion will help us improve the tool.
> Please see attachment for the failed test.
> The comment appears in the form of:
> //Tests pass if .... (it gives some small change to the test which can make the failed
test pass)
> For example:
> //Test passes if var10 is: (double)<0
> java.lang.Double var10 = new java.lang.Double(0.0d);
> means if you change var10 to a double value which is < 0 (e.g., -1d), the failed test
will pass

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message