Author: sebb
Date: Tue Feb  1 23:57:30 2011
New Revision: 1066280

URL: http://svn.apache.org/viewvc?rev=1066280&view=rev
Log:
Use actual array sizes rather than magic numbers

Modified:
    
commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java

Modified: 
commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java?rev=1066280&r1=1066279&r2=1066280&view=diff
==============================================================================
--- 
commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java
 (original)
+++ 
commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/util/FastMath.java
 Tue Feb  1 23:57:30 2011
@@ -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);
         }


Reply via email to