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

Dead code in FastMath.pow(double, double) and some improvement in test coverage

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

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.0
    • None
    • None

    Description

      This issue concerns the FastMath class and its test class.

      (1) In the double pow(double, double) function, there are 2 identical "if" blocks. The second one can be suppressed.
      if (y < 0 && y == yi && (yi & 1) == 1)

      { return Double.NEGATIVE_INFINITY; }

      // this block is never used -> to be suppressed
      if (y < 0 && y == yi && (yi & 1) == 1)

      { return -0.0; }

      if (y > 0 && y == yi && (yi & 1) == 1) { return -0.0; }

      (2) To obtain better code coverage, we added some tests case in FastMathTest.java (see attached file)

      • Added test for log1p
      • Added tests in testPowSpecialCases()
      • Added tests for a 100% coverage of acos().
      • Added tests for a 100% coverage of asin().

      Attachments

        1. FastMath.java.diff
          0.6 kB
          Yannick TANGUY
        2. FastMathTest.java.diff
          23 kB
          Yannick TANGUY

        Activity

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

          People

            Unassigned Unassigned
            ytanguy Yannick TANGUY
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment