You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2005/12/30 14:29:02 UTC
[jira] Commented: (HARMONY-22) Double NaN should compare greater than positive infinity
[ http://issues.apache.org/jira/browse/HARMONY-22?page=comments#action_12361423 ]
Tim Ellison commented on HARMONY-22:
------------------------------------
The rules for (object) Double/Float comparison differ from those for (JLS floating-point) double/float types.
This provides for the natural ordering of the object types (c.f. their implementation of equals(Object) that also differs from JLS types).
ref: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html#compareTo(java.lang.Double)
> Double NaN should compare greater than positive infinity
> --------------------------------------------------------
>
> Key: HARMONY-22
> URL: http://issues.apache.org/jira/browse/HARMONY-22
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Tim Ellison
> Assignee: Tim Ellison
>
> java.lang.Double.compareTo(java.lang.Double) should answer that Double.NaN is greater than Double.POSITIVE_INFINITY.
> Here's a test case that demonstrates the problem:
> public void testDoubleCompare() {
> Double nonNumber = new Double(Double.NaN);
> Double infinity = new Double(Double.POSITIVE_INFINITY);
> int indicator = nonNumber.compareTo(infinity);
> assertEquals("Incorrect comparison result", 1, indicator);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira