commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MATH-370) NaN in "equals" methods
Date Mon, 10 May 2010 10:14:48 GMT

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

Gilles commented on MATH-370:
-----------------------------

Well, the first impression I got from looking at those methods in "MathUtils" was indeed that
they provide the "right" way to compare primitive doubles. Now, the right way for most users
dealing with numerical codes should arguably be IEEE754-compliant.  So, unless we can explain
that the way CM handles NaN is somehow more useful than what the IEEE standard defines, CM
should at least provide "equals" utility methods that stick to the standard.
I understand the usefulness of the current implementation in the examples which you gave,
but as a matter of principle this usage is second in priority (from a user perspective): it
is mainly internal to CM.
Maybe, we should create a "util.internal" package where (CM) developer-utilities methods would
live, whereas "util" would contain the functions which users are most likely looking for.
 I think that it would be clearer (e.g. it would avoid dealing with long names such as "equalsIncludingNaN").
 What do you think?


> NaN in "equals" methods
> -----------------------
>
>                 Key: MATH-370
>                 URL: https://issues.apache.org/jira/browse/MATH-370
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Priority: Minor
>
> In "MathUtils", some "equals" methods will return true if both argument are NaN.
> Unless I'm mistaken, this contradicts the IEEE standard.
> If nobody objects, I'm going to make the changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message