projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Addressed some of the issues raised by John McCabe-Dansted when building
[pspp]
/
src
/
math
/
moments.c
diff --git
a/src/math/moments.c
b/src/math/moments.c
index 9c40016c24b516adad4e412c485f225762545a0d..17040e9f699335fe91021cb5331ce1f257574ef5 100644
(file)
--- a/
src/math/moments.c
+++ b/
src/math/moments.c
@@
-151,8
+151,6
@@
moments_pass_one (struct moments *m, double value, double weight)
void
moments_pass_two (struct moments *m, double value, double weight)
{
void
moments_pass_two (struct moments *m, double value, double weight)
{
- double d, d_power;
-
assert (m != NULL);
if (m->pass == 1)
assert (m != NULL);
if (m->pass == 1)
@@
-164,28
+162,25
@@
moments_pass_two (struct moments *m, double value, double weight)
if (value != SYSMIS && weight >= 0.)
{
if (value != SYSMIS && weight >= 0.)
{
- m->w2 += weight;
-
- d = d_power = value - m->mean;
- m->d1 += d_power * weight;
-
+ double d = value - m->mean;
+ double d1_delta = d * weight;
+ m->d1 += d1_delta;
if (m->max_moment >= MOMENT_VARIANCE)
{
if (m->max_moment >= MOMENT_VARIANCE)
{
- d_power *= d;
- m->d2 += d_power * weight;
-
+ double d2_delta = d1_delta * d;
+ m->d2 += d2_delta;
if (m->max_moment >= MOMENT_SKEWNESS)
{
if (m->max_moment >= MOMENT_SKEWNESS)
{
- d_power *= d;
- m->d3 += d_power * weight;
-
+ double d3_delta = d2_delta * d;
+ m->d3 += d3_delta;
if (m->max_moment >= MOMENT_KURTOSIS)
{
if (m->max_moment >= MOMENT_KURTOSIS)
{
- d
_power *=
d;
- m->d4 += d
_power * weight
;
+ d
ouble d4_delta = d3_delta *
d;
+ m->d4 += d
4_delta
;
}
}
}
}
}
}
+ m->w2 += weight;
}
}
}
}