X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fshapiro-wilk.c;h=30feb39d9ddfb94cb9f844ae5f78444657a54126;hb=e5a3aaeb404e989c3ac0c532c78108601ce26624;hp=f48156e97cfdd5605e36f98e9b00ebaa90971b7c;hpb=0b7e8882ce9bf2166c6bcc0db1334357ba5a76d4;p=pspp diff --git a/src/math/shapiro-wilk.c b/src/math/shapiro-wilk.c index f48156e97c..30feb39d9d 100644 --- a/src/math/shapiro-wilk.c +++ b/src/math/shapiro-wilk.c @@ -116,6 +116,9 @@ shapiro_wilk_calculate (const struct shapiro_wilk *sw) struct shapiro_wilk * shapiro_wilk_create (int n, double mean) { + if (n < 3 || n > 5000) + return NULL; + struct shapiro_wilk *sw = xzalloc (sizeof (*sw)); struct order_stats *os = &sw->parent; struct statistic *stat = &os->parent; @@ -128,9 +131,6 @@ shapiro_wilk_create (int n, double mean) sw->n = n; - if (n < 3 || n > 5000) - return NULL; - const double u = 1.0 / sqrt (sw->n); double m = 0;