X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Ffrequencies.c;h=d20d8392c176d4827a2f4f0e28d3f4e53b73bf0f;hb=3facf6314da231910f60a53805916e879b1782e9;hp=018cc6237e0e1c1f845c11c17c59a18df3bde015;hpb=2569c1e25ddb52f847e688c6b15f1d6c3bb66f28;p=pspp diff --git a/src/language/stats/frequencies.c b/src/language/stats/frequencies.c index 018cc6237e..d20d8392c1 100644 --- a/src/language/stats/frequencies.c +++ b/src/language/stats/frequencies.c @@ -1502,21 +1502,14 @@ calc_stats (const struct frq_proc *frq, const struct var_freqs *vf, int most_often = -1; double X_mode = SYSMIS; - /* Calculate the mode. */ + /* Calculate the mode. If there is more than one mode, we take the + smallest. */ for (f = ft->valid; f < ft->missing; f++) - { - if (most_often < f->count) - { - most_often = f->count; - X_mode = f->values[0].f; - } - else if (most_often == f->count) - { - /* A duplicate mode is undefined. - FIXME: keep track of *all* the modes. */ - X_mode = SYSMIS; - } - } + if (most_often < f->count) + { + most_often = f->count; + X_mode = f->values[0].f; + } /* Calculate moments. */ m = moments_create (MOMENT_KURTOSIS);