I also suggest moving the declaration of d and d_power to inside the 
if ( value != SYSMIS ... ) { } scope.

J' 

On Mon, Feb 05, 2007 at 01:33:48PM -0800, Ben Pfaff wrote:
     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

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature

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

Reply via email to