You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2014/03/25 17:00:37 UTC

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

Author: erans
Date: Tue Mar 25 16:00:36 2014
New Revision: 1581391

URL: http://svn.apache.org/r1581391
Log:
Minimize number of array accesses.

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

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java?rev=1581391&r1=1581390&r2=1581391&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java Tue Mar 25 16:00:36 2014
@@ -2546,9 +2546,11 @@ public class FastMath {
         /* Add in effect of epsB.   atan'(x) = 1/(1+x^2) */
         yb += epsB / (1d + epsA * epsA);
 
+        final double eighths = EIGHTHS[idx];
+
         //result = yb + eighths[idx] + ya;
-        double za = EIGHTHS[idx] + ya;
-        double zb = -(za - EIGHTHS[idx] - ya);
+        double za = eighths + ya;
+        double zb = -(za - eighths - ya);
         temp = za + yb;
         zb += -(temp - za - yb);
         za = temp;