MATH-486 FastMath toRadian and toDegree don't handle large double numbers well
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1060967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0900d78b9a
commit
c1d889840c
|
@ -3239,7 +3239,10 @@ public class FastMath {
|
|||
final double facta = 0.01745329052209854;
|
||||
final double factb = 1.997844754509471E-9;
|
||||
|
||||
double temp = x * 1073741824.0;
|
||||
double temp = 0;
|
||||
if (abs(x) < Double.MAX_VALUE/1073741824.0) { // prevent overflow to infinity
|
||||
temp = x * 1073741824.0;
|
||||
}
|
||||
double xa = x + temp - temp;
|
||||
double xb = x - xa;
|
||||
|
||||
|
@ -3264,7 +3267,10 @@ public class FastMath {
|
|||
final double facta = 57.2957763671875;
|
||||
final double factb = 3.145894820876798E-6;
|
||||
|
||||
double temp = x * 1073741824.0;
|
||||
double temp = 0;
|
||||
if (abs(x) < Double.MAX_VALUE/1073741824.0) { // prevent overflow to infinity
|
||||
temp = x * 1073741824.0;
|
||||
}
|
||||
double xa = x + temp - temp;
|
||||
double xb = x - xa;
|
||||
|
||||
|
|
Loading…
Reference in New Issue