commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Juntunen (JIRA)" <j...@apache.org>
Subject [jira] [Created] (NUMBERS-94) PlaneAngle normalize fails for very small numbers.
Date Thu, 14 Feb 2019 05:11:00 GMT
Matt Juntunen created NUMBERS-94:
------------------------------------

             Summary: PlaneAngle normalize fails for very small numbers.
                 Key: NUMBERS-94
                 URL: https://issues.apache.org/jira/browse/NUMBERS-94
             Project: Commons Numbers
          Issue Type: Bug
            Reporter: Matt Juntunen


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:
{code:java}
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)
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message