You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2011/01/17 18:15:43 UTC

[jira] Created: (MATH-481) MathUtils.equals(double x, double y) disagrees with Javadoc

MathUtils.equals(double x, double y) disagrees with Javadoc
-----------------------------------------------------------

                 Key: MATH-481
                 URL: https://issues.apache.org/jira/browse/MATH-481
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 2.1
            Reporter: Sebb


MathUtils.equals(double x, double y) disagrees with Javadoc.

The Javadoc says:

Returns true iff they are equal as defined by  {@link #equals(double,double,int)}

However, the code actually uses == and checks for NaN:

{code}
public static boolean equals(double x, double y) {
    return (Double.isNaN(x) && Double.isNaN(y)) || x == y;
}
{code}

The method is deprecated, but it should probably still be consistent with its documentation.

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


[jira] Resolved: (MATH-481) MathUtils.equals(double x, double y) disagrees with Javadoc

Posted by "Gilles (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles resolved MATH-481.
-------------------------

       Resolution: Fixed
    Fix Version/s: 2.2

Corrected Javadoc in revision 1060117.


> MathUtils.equals(double x, double y) disagrees with Javadoc
> -----------------------------------------------------------
>
>                 Key: MATH-481
>                 URL: https://issues.apache.org/jira/browse/MATH-481
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Sebb
>             Fix For: 2.2
>
>
> MathUtils.equals(double x, double y) disagrees with Javadoc.
> The Javadoc says:
> Returns true iff they are equal as defined by  {@link #equals(double,double,int)}
> However, the code actually uses == and checks for NaN:
> {code}
> public static boolean equals(double x, double y) {
>     return (Double.isNaN(x) && Double.isNaN(y)) || x == y;
> }
> {code}
> The method is deprecated, but it should probably still be consistent with its documentation.

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


[jira] [Closed] (MATH-481) MathUtils.equals(double x, double y) disagrees with Javadoc

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe closed MATH-481.
------------------------------


Closing issue as it was included in version 2.2, which has been released

> MathUtils.equals(double x, double y) disagrees with Javadoc
> -----------------------------------------------------------
>
>                 Key: MATH-481
>                 URL: https://issues.apache.org/jira/browse/MATH-481
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.1
>            Reporter: Sebb
>             Fix For: 2.2
>
>
> MathUtils.equals(double x, double y) disagrees with Javadoc.
> The Javadoc says:
> Returns true iff they are equal as defined by  {@link #equals(double,double,int)}
> However, the code actually uses == and checks for NaN:
> {code}
> public static boolean equals(double x, double y) {
>     return (Double.isNaN(x) && Double.isNaN(y)) || x == y;
> }
> {code}
> The method is deprecated, but it should probably still be consistent with its documentation.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira