diff --git a/src/java/org/apache/commons/math/special/Beta.java b/src/java/org/apache/commons/math/special/Beta.java
index 4239c252d..904e15663 100644
--- a/src/java/org/apache/commons/math/special/Beta.java
+++ b/src/java/org/apache/commons/math/special/Beta.java
@@ -33,7 +33,7 @@ public class Beta implements Serializable {
private static final long serialVersionUID = -3833485397404128220L;
/** Maximum allowed numerical error. */
- private static final double DEFAULT_EPSILON = 10e-9;
+ private static final double DEFAULT_EPSILON = 10e-15;
/**
* Default constructor. Prohibit instantiation.
diff --git a/src/java/org/apache/commons/math/special/Gamma.java b/src/java/org/apache/commons/math/special/Gamma.java
index 8c565cbff..ba2c4dbf3 100644
--- a/src/java/org/apache/commons/math/special/Gamma.java
+++ b/src/java/org/apache/commons/math/special/Gamma.java
@@ -34,7 +34,7 @@ public class Gamma implements Serializable {
private static final long serialVersionUID = -6587513359895466954L;
/** Maximum allowed numerical error. */
- private static final double DEFAULT_EPSILON = 10e-9;
+ private static final double DEFAULT_EPSILON = 10e-15;
/** Lanczos coefficients */
private static double[] lanczos =
diff --git a/src/test/org/apache/commons/math/special/BetaTest.java b/src/test/org/apache/commons/math/special/BetaTest.java
index 5e916e246..01446afce 100644
--- a/src/test/org/apache/commons/math/special/BetaTest.java
+++ b/src/test/org/apache/commons/math/special/BetaTest.java
@@ -38,7 +38,7 @@ public class BetaTest extends TestCase {
{
try {
double actual = Beta.regularizedBeta(x, a, b);
- TestUtils.assertEquals(expected, actual, 10e-5);
+ TestUtils.assertEquals(expected, actual, 10e-15);
} catch(MathException ex){
fail(ex.getMessage());
}
@@ -46,7 +46,7 @@ public class BetaTest extends TestCase {
private void testLogBeta(double expected, double a, double b) {
double actual = Beta.logBeta(a, b);
- TestUtils.assertEquals(expected, actual, 10e-5);
+ TestUtils.assertEquals(expected, actual, 10e-15);
}
public void testRegularizedBetaNanPositivePositive() {
@@ -114,6 +114,6 @@ public class BetaTest extends TestCase {
}
public void testLogBetaPositivePositive() {
- testLogBeta(-0.693147, 1.0, 2.0);
+ testLogBeta(-0.693147180559945, 1.0, 2.0);
}
}
\ No newline at end of file
diff --git a/src/test/org/apache/commons/math/special/GammaTest.java b/src/test/org/apache/commons/math/special/GammaTest.java
index e7524f1b6..e7d459616 100644
--- a/src/test/org/apache/commons/math/special/GammaTest.java
+++ b/src/test/org/apache/commons/math/special/GammaTest.java
@@ -37,8 +37,8 @@ public class GammaTest extends TestCase {
try {
double actualP = Gamma.regularizedGammaP(a, x);
double actualQ = Gamma.regularizedGammaQ(a, x);
- TestUtils.assertEquals(expected, actualP, 10e-5);
- TestUtils.assertEquals(actualP, 1.0 - actualQ, 10e-5);
+ TestUtils.assertEquals(expected, actualP, 10e-15);
+ TestUtils.assertEquals(actualP, 1.0 - actualQ, 10e-15);
} catch(MathException ex){
fail(ex.getMessage());
}
@@ -46,7 +46,7 @@ public class GammaTest extends TestCase {
private void testLogGamma(double expected, double x) {
double actual = Gamma.logGamma(x);
- TestUtils.assertEquals(expected, actual, 10e-5);
+ TestUtils.assertEquals(expected, actual, 10e-15);
}
public void testRegularizedGammaNanPositive() {
@@ -74,7 +74,7 @@ public class GammaTest extends TestCase {
}
public void testRegularizedGammaPositivePositive() {
- testRegularizedGamma(0.632121, 1.0, 1.0);
+ testRegularizedGamma(0.632120558828558, 1.0, 1.0);
}
public void testLogGammaNan() {
@@ -90,6 +90,6 @@ public class GammaTest extends TestCase {
}
public void testLogGammaPositive() {
- testLogGamma(0.693147, 3.0);
+ testLogGamma(0.6931471805599457, 3.0);
}
}
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index f8f088c0e..441a7a262 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -78,6 +78,9 @@ Commons Math Release Notes
Corrected nextInt and nextLong to handle wide value ranges.
+
+ Increased default precision of Gamma and Beta functions.
+