Don't append % to count totals.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 14 Sep 2008 13:29:53 +0000 (21:29 +0800)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 14 Sep 2008 13:29:53 +0000 (21:29 +0800)
There was an erroneous '%' appended to the totals for count
values. This change removes it.  Fixes bug #24003

src/language/stats/crosstabs.q
tests/bugs/crosstabs-crash.sh
tests/bugs/crosstabs-crash2.sh
tests/command/longvars.sh

index fcfccc39a251c2fbbfffbda7a6913207a70d1757..4c5309bfda6e1dd0053331ee9da3f8029b5c8a27 100644 (file)
@@ -1861,7 +1861,6 @@ display_crosstabulation (void)
     tab_offset (table, -1, tab_row (table) - num_cells * n_rows);
     for (r = 0; r < n_rows; r++)
       {
-        char suffix = 0;
         bool mark_missing = false;
 
         if (cmd.miss == CRS_REPORT
@@ -1870,6 +1869,7 @@ display_crosstabulation (void)
 
         for (i = 0; i < num_cells; i++)
           {
+            char suffix = 0;
             double v;
 
             switch (cells[i])
@@ -1878,7 +1878,7 @@ display_crosstabulation (void)
                 v = row_tot[r];
                 break;
               case CRS_CL_ROW:
-                v = 100.;
+                v = 100.0;
                 suffix = '%';
                 break;
               case CRS_CL_COLUMN:
@@ -1916,7 +1916,6 @@ display_crosstabulation (void)
       {
        double ct = c < n_cols ? col_tot[c] : W;
         bool mark_missing = false;
-        char suffix = 0;
         int i;
 
         if (cmd.miss == CRS_REPORT && c < n_cols
@@ -1925,13 +1924,13 @@ display_crosstabulation (void)
 
         for (i = 0; i < num_cells; i++)
          {
+            char suffix = 0;
            double v;
 
            switch (cells[i])
              {
              case CRS_CL_COUNT:
                v = ct;
-                suffix = '%';
                break;
              case CRS_CL_ROW:
                v = ct / W * 100.;
@@ -1954,7 +1953,7 @@ display_crosstabulation (void)
                 NOT_REACHED ();
              }
 
-            format_cell_entry (table, c, i, v, suffix, mark_missing);
+           format_cell_entry (table, c, i, v, suffix, mark_missing);
          }
         last_row = i;
       }
index 99ec07cac271ebf44c7fbccd528ef9547122d144..eea89304599d63e3c7558ed21f9775f84f40c9f1 100755 (executable)
@@ -108,7 +108,7 @@ diff -b  -w $TEMPDIR/pspp.list - << EOF
 #           5.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
 #           6.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
 #           7.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
-#Total          #     .0%|     .0%|     .0%|     .0%|    1.0%|     .0%|     .0%|    1.0%#
+#Total          #      .0|      .0|      .0|      .0|     1.0|      .0|      .0|     1.0#
 #===============#========#========#========#========#========#========#========#========#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
index 5866d0e58c584d5ca28f8a611dca22372c1094e7..060fa234378eaa0a926da02cf08d64d77a01a386 100755 (executable)
@@ -108,7 +108,7 @@ $TEMPDIR/crosstabs-crash2.sh.sps:6: warning: BEGIN DATA: Missing value(s) for al
 #           1.00#     1.0|      .0|      .0|     1.0|     2.0#
 #           2.00#      .0|      .0|     1.0|      .0|     1.0#
 #           3.00#      .0|     1.0|      .0|      .0|     1.0#
-#Total          #    1.0%|    1.0%|    1.0%|    1.0%|    4.0%#
+#Total          #     1.0|     1.0|     1.0|     1.0|     4.0#
 #===============#========#========#========#========#========#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi
index 2a75f64b5e8ab629dfa50c556f8213c094184c26..49a7cd4c2a26c449034973e35e8f415fb7c5d0c3 100755 (executable)
@@ -119,7 +119,7 @@ AlphaBetaGamma        B        X Yabbadabbadoo
 #           5.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
 #           6.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
 #           7.00#      .0|      .0|      .0|      .0|      .0|      .0|      .0|      .0#
-#Total          #     .0%|     .0%|     .0%|     .0%|    1.0%|     .0%|     .0%|    1.0%#
+#Total          #      .0|      .0|      .0|      .0|     1.0|      .0|      .0|     1.0#
 #===============#========#========#========#========#========#========#========#========#
 EOF
 if [ $? -ne 0 ] ; then fail ; fi