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:
parent
6cdfda8ce1
commit
485d717636
|
@ -3243,7 +3243,11 @@ public class FastMath {
|
||||||
double xa = x + temp - temp;
|
double xa = x + temp - temp;
|
||||||
double xb = x - xa;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue