commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: svn commit: r1165846 [2/2] - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
Date Tue, 06 Sep 2011 23:04:59 GMT
Hello.

> 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=1165846&r1=1165845&r2=1165846&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 Sep  6 21:06:58 2011
> @@ -74,31 +74,6147 @@ public class FastMath {
>      /** Napier's constant e, base of the natural logarithm. */
>      public static final double E = 2850325.0 / 1048576.0 + 8.254840070411028747e-8;
>  
> +    private static final int EXP_INT_TABLE_MAX_INDEX = 750;
> +    private static final int EXP_INT_TABLE_LEN = EXP_INT_TABLE_MAX_INDEX * 2;
> +
>      /** Exponential evaluated at integer values,
> -     * exp(x) =  expIntTableA[x + 750] + expIntTableB[x+750].
> +     * exp(x) =  expIntTableA[x + EXP_INT_TABLE_MAX_INDEX] + expIntTableB[x+EXP_INT_TABLE_MAX_INDEX].
>       */
> -    private static final double EXP_INT_TABLE_A[] = new double[1500];
> +    private static final double EXP_INT_TABLE_A[] = 
> +    {
> +        +0.0d,
> +        Double.NaN,

[More than 6000 lines stripped.]

Wouldn't it be advantageous to store those tabulated data in separate
Java files? E.g.
---
class ExpIntTables {
    static final double[] A = {
      // Very long table.
    };
    static final double[] B = {
      // ...
    };
---

And in "FastMath.java":
---
public class FastMath {
    private static final double[] EXP_INT_TABLE_A = ExpIntTables.A;
    private static final double[] EXP_INT_TABLE_B = ExpIntTables.B;
}
---


Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message