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/branches/MATH_2_X@1060960 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2011-01-19 20:13:11 +00:00
parent 6cdfda8ce1
commit 485d717636
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;
}
/**