Uploaded image for project: 'Commons Numbers'
  1. Commons Numbers
  2. NUMBERS-94

PlaneAngle normalize fails for very small numbers.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta1
    • angle
    • None

    Description

      When the PlaneAngle.normalize() method is called to normalize between 0 and 1 turns and is passed a very small number compared to the 1, then the method returns a number exactly equal to the angle upper bound. This breaks the API contract since the return value must be strictly less than the upper bound. Ex:

      PlaneAngle angle = PlaneAngle.ofTurns(-1e-18);
      double normalized = angle.normalize(PlaneAngle.PI).toTurns();
      // normalized is equal to 1 but it should be 0 since 1 - 1e-18 = 1, which is equivalent to 0 in turns
      

      Pull request: https://github.com/apache/commons-numbers/pull/30

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mattjuntunen Matt Juntunen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h