/[pspp]/pspp/src/aggregate.c
ViewVC logotype

Diff of /pspp/src/aggregate.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.29 by blp, Sat Mar 19 22:50:59 2005 UTC revision 1.30 by blp, Sun Mar 20 07:08:32 2005 UTC
# Line 524  parse_aggregate_functions (struct agr_pr Line 524  parse_aggregate_functions (struct agr_pr
524            /* Create the target variable in the aggregate            /* Create the target variable in the aggregate
525               dictionary. */               dictionary. */
526            {            {
527                static const struct fmt_spec f8_2 = {FMT_F, 8, 2};
528              struct variable *destvar;              struct variable *destvar;
529                            
530              v->function = func_index;              v->function = func_index;
# Line 545  parse_aggregate_functions (struct agr_pr Line 546  parse_aggregate_functions (struct agr_pr
546                    {                    {
547                      destvar = dict_create_var (agr->dict, dest[i], 0);                      destvar = dict_create_var (agr->dict, dest[i], 0);
548                                                    
549                      if ((func_index == N                      if ((func_index == N || func_index == NMISS)
                             || func_index == N_NO_VARS  
                             || func_index == NMISS)  
550                          && dict_get_weight (default_dict) != NULL)                          && dict_get_weight (default_dict) != NULL)
551                        {                        destvar->print = destvar->write = f8_2;
                         static const struct fmt_spec f8_2 = {FMT_F, 8, 2};  
                               
                         destvar->print = destvar->write = f8_2;  
                       }  
552                      else                      else
553                        destvar->print = destvar->write = function->format;                        destvar->print = destvar->write = function->format;
554                    }                    }
# Line 563  parse_aggregate_functions (struct agr_pr Line 558  parse_aggregate_functions (struct agr_pr
558                } else {                } else {
559                  v->src = NULL;                  v->src = NULL;
560                  destvar = dict_create_var (agr->dict, dest[i], 0);                  destvar = dict_create_var (agr->dict, dest[i], 0);
561                    if (func_index == N_NO_VARS
562                        && dict_get_weight (default_dict) != NULL)
563                      destvar->print = destvar->write = f8_2;
564                    else
565                      destvar->print = destvar->write = function->format;
566                }                }
567                        
568              if (!destvar)              if (!destvar)
# Line 834  accumulate_aggregate_info (struct agr_pr Line 834  accumulate_aggregate_info (struct agr_pr
834            {            {
835            case SUM:            case SUM:
836              iter->dbl[0] += v->f * weight;              iter->dbl[0] += v->f * weight;
837                iter->int1 = 1;
838              break;              break;
839            case MEAN:            case MEAN:
840              iter->dbl[0] += v->f * weight;              iter->dbl[0] += v->f * weight;
# Line 1006  dump_aggregate_info (struct agr_proc *ag Line 1007  dump_aggregate_info (struct agr_proc *ag
1007          switch (i->function)          switch (i->function)
1008            {            {
1009            case SUM:            case SUM:
1010              v->f = i->dbl[0];              v->f = i->int1 ? i->dbl[0] : SYSMIS;
1011              break;              break;
1012            case MEAN:            case MEAN:
1013              v->f = i->dbl[1] != 0.0 ? i->dbl[0] / i->dbl[1] : SYSMIS;              v->f = i->dbl[1] != 0.0 ? i->dbl[0] / i->dbl[1] : SYSMIS;

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26