Simplify code by using doubleHighPart

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_X@1062258 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2011-01-22 20:26:34 +00:00
parent fd9fbe39b6
commit 5ac0307deb
1 changed files with 3 additions and 17 deletions

View File

@ -3205,13 +3205,7 @@ public class FastMath {
return Math.PI/2; // so return the appropriate value return Math.PI/2; // so return the appropriate value
} }
if (abs(r) < Double.MAX_VALUE/HEX_40000000){ // is it safe to split r ? double ra = doubleHighPart(r);
temp = r * HEX_40000000;
} else {
temp = 0.0;
}
double ra = r + temp - temp;
double rb = r - ra; double rb = r - ra;
rb += (y - ra*xa - ra*xb - rb*xa - rb*xb) / x; // Correct for rounding in division rb += (y - ra*xa - ra*xb - rb*xa - rb*xb) / x; // Correct for rounding in division
@ -3323,11 +3317,7 @@ public class FastMath {
final double facta = 0.01745329052209854; final double facta = 0.01745329052209854;
final double factb = 1.997844754509471E-9; final double factb = 1.997844754509471E-9;
double temp = 0; double xa = doubleHighPart(x);
if (abs(x) < Double.MAX_VALUE/HEX_40000000) { // prevent overflow to infinity
temp = x * HEX_40000000;
}
double xa = x + temp - temp;
double xb = x - xa; double xb = x - xa;
double result = xb * factb + xb * facta + xa * factb + xa * facta; double result = xb * factb + xb * facta + xa * factb + xa * facta;
@ -3352,11 +3342,7 @@ public class FastMath {
final double facta = 57.2957763671875; final double facta = 57.2957763671875;
final double factb = 3.145894820876798E-6; final double factb = 3.145894820876798E-6;
double temp = 0; double xa = doubleHighPart(x);
if (abs(x) < Double.MAX_VALUE/HEX_40000000) { // prevent overflow to infinity
temp = x * HEX_40000000;
}
double xa = x + temp - temp;
double xb = x - xa; double xb = x - xa;
return xb * factb + xb * facta + xa * factb + xa * facta; return xb * factb + xb * facta + xa * factb + xa * facta;