Ensure correct sign when toRadians() returns zero

[Not needed for toDegrees() as the calculation does not underflow]

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1060959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2011-01-19 20:12:38 +00:00
parent bd77d3cff2
commit 0900d78b9a
1 changed files with 5 additions and 1 deletions

View File

@ -3243,7 +3243,11 @@ public class FastMath {
double xa = x + temp - temp;
double xb = x - xa;
return xb * factb + xb * facta + xa * factb + xa * facta;
double result = xb * factb + xb * facta + xa * factb + xa * facta;
if (result == 0) {
result = result * x; // ensure correct sign
}
return result;
}
/**