From c6ac38c5bf3cc30e7283380efc1321b0229ccaad Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Tue, 1 Feb 2011 23:57:30 +0000 Subject: [PATCH] Use actual array sizes rather than magic numbers git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/branches/MATH_2_X@1066280 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/java/org/apache/commons/math/util/FastMath.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/math/util/FastMath.java b/src/main/java/org/apache/commons/math/util/FastMath.java index 28788787b..977f3ed66 100644 --- a/src/main/java/org/apache/commons/math/util/FastMath.java +++ b/src/main/java/org/apache/commons/math/util/FastMath.java @@ -206,7 +206,7 @@ public class FastMath { // Generate an array of factorials FACT[0] = 1.0; - for (i = 1; i < 20; i++) { + for (i = 1; i < FACT.length; i++) { FACT[i] = FACT[i-1] * i; } @@ -228,14 +228,14 @@ public class FastMath { } // Populate expFracTable - for (i = 0; i < 1025; i++) { + for (i = 0; i < EXP_FRAC_TABLE_A.length; i++) { slowexp(i/1024.0, tmp); EXP_FRAC_TABLE_A[i] = tmp[0]; EXP_FRAC_TABLE_B[i] = tmp[1]; } // Populate lnMant table - for (i = 0; i < 1024; i++) { + for (i = 0; i < LN_MANT.length; i++) { double d = Double.longBitsToDouble( (((long) i) << 42) | 0x3ff0000000000000L ); LN_MANT[i] = slowLog(d); }