When I looked at src/math/moments.c earlier, it seemed like we
were doing more multiplications than necessary.  I'd like to
check in the following change.  It passes "make check".  Any
comments?

--- moments.c.~1.4.~    2007-02-05 13:19:12.000000000 -0800
+++ moments.c   2007-02-05 13:25:17.000000000 -0800
@@ -166,23 +166,24 @@ moments_pass_two (struct moments *m, dou
     {
       m->w2 += weight;
 
-      d = d_power = value - m->mean;
-      m->d1 += d_power * weight;
+      d = value - m->mean;
+      d_power = d * weight;
+      m->d1 += d_power;
 
       if (m->max_moment >= MOMENT_VARIANCE) 
         {
           d_power *= d;
-          m->d2 += d_power * weight;
+          m->d2 += d_power;
 
           if (m->max_moment >= MOMENT_SKEWNESS)
             {
               d_power *= d;
-              m->d3 += d_power * weight;
+              m->d3 += d_power;
 
               if (m->max_moment >= MOMENT_KURTOSIS)
                 {
                   d_power *= d;
-                  m->d4 += d_power * weight;
+                  m->d4 += d_power;
                 }
             }
         }


-- 
Ben Pfaff 
[EMAIL PROTECTED]
http://benpfaff.org


_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to