X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fpercentiles.c;h=9055279b5afa1db5f54db6a0cb062eaf734d78bf;hb=8b585b7a6ae9d1a90386d56e3ce484cf8204743a;hp=c76bb492ba767a90ffa2c03c8d35bf8a7d532ab6;hpb=07db00919d6f067fd5dd6c6c1c2c2fba4f42cf21;p=pspp diff --git a/src/math/percentiles.c b/src/math/percentiles.c index c76bb492ba..9055279b5a 100644 --- a/src/math/percentiles.c +++ b/src/math/percentiles.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,22 +15,22 @@ along with this program. If not, see . */ #include -#include "percentiles.h" -#include +#include "math/percentiles.h" + +#include "data/casereader.h" +#include "data/val-type.h" +#include "data/variable.h" +#include "libpspp/assertion.h" +#include "libpspp/cast.h" +#include "math/order-stats.h" + +#include "gl/xalloc.h" #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) msgid -#include -#include -#include -#include -#include -#include - - const char *const ptile_alg_desc[] = { "", N_("HAverage"), @@ -48,8 +48,6 @@ percentile_calculate (const struct percentile *ptl, enum pc_alg alg) struct percentile *mutable = CONST_CAST (struct percentile *, ptl); const struct order_stats *os = &ptl->parent; - assert (os->cc == ptl->w); - if ( ptl->g1 == SYSMIS) mutable->g1 = (os->k[0].tc - os->k[0].cc) / os->k[0].c_p1; @@ -176,7 +174,7 @@ percentile_create (double p, double W) ptl->w = W; os->n_k = 2; - os->k = xcalloc (sizeof (*os->k), 2); + os->k = xcalloc (2, sizeof (*os->k)); os->k[0].tc = W * p; os->k[1].tc = (W + 1.0) * p;