You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/02/02 00:56:36 UTC

svn commit: r1066279 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java

Author: sebb
Date: Tue Feb  1 23:56:36 2011
New Revision: 1066279

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

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

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