This is an automated email from the ASF dual-hosted git repository. erans pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 56cde56fdf5d5661cc8ccfd1d3928e9ca9b52b7d Author: Gilles Sadowski <gil...@harfang.homelinux.org> AuthorDate: Thu Feb 14 22:07:41 2019 +0100 Use "final". --- .../apache/commons/numbers/angle/PlaneAngle.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java index 8a7ce0e..6870386 100644 --- a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java +++ b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java @@ -97,18 +97,17 @@ public class PlaneAngle { final double lowerBound = center.value - HALF_TURN; final double upperBound = center.value + HALF_TURN; - double normalized = value - Math.floor(value - lowerBound); + final double normalized = value - Math.floor(value - lowerBound); - // If value is too small to be representable compared to the floor - // expression above (ie, if value + x = x), then we may end up with a number - // exactly equal to the upper bound here. In that case, subtract - // one from the normalized value so that we can fulfill the contract - // of only returning results strictly less than the upper bound. - if (normalized >= upperBound) { - normalized -= 1.0; - } - - return new PlaneAngle(normalized); + return normalized < upperBound ? + new PlaneAngle(normalized) : + // If value is too small to be representable compared to the + // floor expression above (ie, if value + x = x), then we may + // end up with a number exactly equal to the upper bound here. + // In that case, subtract one from the normalized value so that + // we can fulfill the contract of only returning results strictly + // less than the upper bound. + new PlaneAngle(normalized - 1); } /**