Anthony Maidment created LANG-1541:
--------------------------------------

             Summary: ArrayUtils.contains() fails to handle Double.NaN
                 Key: LANG-1541
                 URL: https://issues.apache.org/jira/browse/LANG-1541
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
    Affects Versions: 3.10, 3.7
            Reporter: Anthony Maidment


 

ArrayUtils.contains(double[], double) does not handle Double.NaN correctly. 
That is, ArrayUtils.contains() returns false, even if the given array contains 
Double.NaN.

 

For example, consider the following

 
{code:java}
double[] a = new double[]{Double.NEGATIVE_INFINITY, Double.NaN, 
Double.POSITIVE_INFINITY};
System.out.println(ArrayUtils.contains(a, Double.POSITIVE_INFINITY)); // true
System.out.println(ArrayUtils.contains(a, Double.NEGATIVE_INFINITY)); // true
System.out.println(ArrayUtils.contains(a, Double.NaN)); // false ?
{code}
 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to