MATH-790: Patch applied to fix the second overflow issue.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1349372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mikkel Meyer Andersen 2012-06-12 14:27:56 +00:00
parent 069590396c
commit 07d05a070c

View File

@ -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;