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

FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0)

Rank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

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

    Description

      FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0):

      min(float 0.0, float -0.0) expected -0.0 actual 0.0
      min(float Infinity, float -Infinity) expected -Infinity actual NaN
      max(float 0.0, float -0.0) expected 0.0 actual -0.0
      max(float Infinity, float -Infinity) expected Infinity actual NaN

      Similarly for the double versions.

      The Infinity failures are because the code uses Float.isNaN(a + b) which gives NaN when +/1- Infinity are added together.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment