You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mi...@apache.org on 2012/06/12 16:27:57 UTC
svn commit: r1349372 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/inference/MannWhitneyUTest.java
Author: mikl
Date: Tue Jun 12 14:27:56 2012
New Revision: 1349372
URL: http://svn.apache.org/viewvc?rev=1349372&view=rev
Log:
MATH-790: Patch applied to fix the second overflow issue.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/inference/MannWhitneyUTest.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/inference/MannWhitneyUTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/inference/MannWhitneyUTest.java?rev=1349372&r1=1349371&r2=1349372&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/inference/MannWhitneyUTest.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/inference/MannWhitneyUTest.java Tue Jun 12 14:27:56 2012
@@ -170,7 +170,10 @@ public class MannWhitneyUTest {
final int n2)
throws ConvergenceException, MaxCountExceededException {
- final double n1n2prod = n1 * n2;
+ /* long multiplication to avoid overflow (double not used due to efficiency
+ * and to avoid precision loss)
+ */
+ final long n1n2prod = (long) n1 * n2;
// http://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U#Normal_approximation
final double EU = n1n2prod / 2.0;