Author: psteitz
Date: Wed Jun 20 15:24:04 2007
New Revision: 549278
URL: http://svn.apache.org/viewvc?view=rev&rev=549278
Log:
Increased default epsilon for Gamma, Beta function evaluation.
JIRA: MATH-166
Reported and patched by Lukas Theussl
Modified:
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Beta.java
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Gamma.java
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/BetaTest.java
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/GammaTest.java
jakarta/commons/proper/math/trunk/xdocs/changes.xml
Modified:
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Beta.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Beta.java?view=diff&rev=549278&r1=549277&r2=549278
==============================================================================
---
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Beta.java
(original)
+++
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Beta.java
Wed Jun 20 15:24:04 2007
@@ -33,7 +33,7 @@
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.
Modified:
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Gamma.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Gamma.java?view=diff&rev=549278&r1=549277&r2=549278
==============================================================================
---
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Gamma.java
(original)
+++
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/special/Gamma.java
Wed Jun 20 15:24:04 2007
@@ -34,7 +34,7 @@
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 =
Modified:
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/BetaTest.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/BetaTest.java?view=diff&rev=549278&r1=549277&r2=549278
==============================================================================
---
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/BetaTest.java
(original)
+++
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/BetaTest.java
Wed Jun 20 15:24:04 2007
@@ -38,7 +38,7 @@
{
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 @@
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 void testLogBetaPositivePositive() {
- testLogBeta(-0.693147, 1.0, 2.0);
+ testLogBeta(-0.693147180559945, 1.0, 2.0);
}
}
Modified:
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/GammaTest.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/GammaTest.java?view=diff&rev=549278&r1=549277&r2=549278
==============================================================================
---
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/GammaTest.java
(original)
+++
jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/special/GammaTest.java
Wed Jun 20 15:24:04 2007
@@ -37,8 +37,8 @@
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 @@
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 void testRegularizedGammaPositivePositive() {
- testRegularizedGamma(0.632121, 1.0, 1.0);
+ testRegularizedGamma(0.632120558828558, 1.0, 1.0);
}
public void testLogGammaNan() {
@@ -90,6 +90,6 @@
}
public void testLogGammaPositive() {
- testLogGamma(0.693147, 3.0);
+ testLogGamma(0.6931471805599457, 3.0);
}
}
Modified: jakarta/commons/proper/math/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/math/trunk/xdocs/changes.xml?view=diff&rev=549278&r1=549277&r2=549278
==============================================================================
--- jakarta/commons/proper/math/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/math/trunk/xdocs/changes.xml Wed Jun 20 15:24:04 2007
@@ -78,6 +78,9 @@
<action dev="brentworden" type="fix" issue="MATH-153" due-to="Remi
Arntzen">
Corrected nextInt and nextLong to handle wide value ranges.
</action>
+ <action dev="psteitz" type="fix" issue="MATH-166" due-to="Lukas Theussl">
+ Increased default precision of Gamma and Beta functions.
+ </action>
</release>
<release version="1.1" date="2005-12-17"
description="This is a maintenance release containing bug fixes and
enhancements.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]