Merge commit 'origin/stable'
[pspp-builds.git] / src / language / stats / reliability.q
index edacdf12a1a5aea5fb615b91d07cfc0f80fb39cd..8384bb350312100214e33cfcff1b1f5057d70703 100644 (file)
@@ -262,8 +262,11 @@ cmd_reliability (struct lexer *lexer, struct dataset *ds)
       free (c->items);
 
       moments1_destroy (c->total);
-      for (x = 0 ; x < c->n_items; ++x)
-       moments1_destroy (c->m[x]);
+
+      if ( c->m)
+       for (x = 0 ; x < c->n_items; ++x)
+         moments1_destroy (c->m[x]);
+
       free (c->m);
     }
 
@@ -640,10 +643,10 @@ reliability_statistics_model_split (struct tab_table *tbl,
     tab_float (tbl, 3, 8, TAB_RIGHT, g, 8, 3);
 
     tmp = (1.0 - r*r) * rel->sc[1].n_items * rel->sc[2].n_items /
-      SQR (rel->sc[0].n_items);
+      pow2 (rel->sc[0].n_items);
 
-    uly = sqrt( SQR (SQR (r)) + 4 * SQR (r) * tmp);
-    uly -= SQR (r);
+    uly = sqrt( pow4 (r) + 4 * pow2 (r) * tmp);
+    uly -= pow2 (r);
     uly /= 2 * tmp;
 
     tab_float (tbl, 3, 7, TAB_RIGHT, uly, 8, 3);