Fixed bug parsing binomial test.
[pspp-builds.git] / src / language / stats / npar.q
index 8c6f98f82cf669275376313a03650b9ba5de0ff8..535797227b2a23974e6a13da5ed265b0a8c419b2 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <config.h>
 
+
 #include <language/stats/npar.h>
 
 #include <math.h>
@@ -133,6 +134,7 @@ npar_execute(struct casereader *input,
   casereader_destroy (input);
 }
 
+
 int
 cmd_npar_tests (struct lexer *lexer, struct dataset *ds)
 {
@@ -338,7 +340,9 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds,
 
   btp->category1 = btp->category2 = btp->cutpoint = SYSMIS;
 
-  if ( lex_match(lexer, '(') )
+  btp->p = 0.5;
+
+  if ( lex_match (lexer, '(') )
     {
       if ( lex_force_num (lexer) )
        {
@@ -349,6 +353,10 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds,
       else
        return 0;
     }
+  else
+    /* Kludge: q2c swallows the '=' so put it back here  */
+     lex_put_back (lexer, '=');
+
 
   if ( lex_match (lexer, '=') )
     {
@@ -377,6 +385,7 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds,
        }
       else
        return 2;
+
     }
 
   specs->n_tests++;