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

Complex Add and Subtract handle NaN arguments differently, but javadoc contracts are the same

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2, 2.0, 2.1, 2.2
    • 3.0
    • None
    • None

    Description

      For both Complex add and subtract, the javadoc states that

           * If either this or <code>rhs</code> has a NaN value in either part,
           * {@link #NaN} is returned; otherwise Inifinite and NaN values are
           * returned in the parts of the result according to the rules for
           * {@link java.lang.Double} arithmetic
      

      Subtract includes an isNaN test and returns Complex.NaN if either complex argument isNaN; but add omits this test. The test should be added to the add implementation (actually restored, since this looks like a code merge problem going back to 1.1).

      Attachments

        Activity

          People

            Unassigned Unassigned
            psteitz Phil Steitz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: