Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-481

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Labels:
      None

      Description

      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:

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

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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sebb Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: