projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
FREQUENCIES: Fix percentiles calculation.
[pspp-builds.git]
/
src
/
language
/
stats
/
frequencies.q
diff --git
a/src/language/stats/frequencies.q
b/src/language/stats/frequencies.q
index e397eb8760361fe70fa1a679f6955cc9585daebf..adc4f16b359876ff350f2c5b36c2ecdaa37a6ee6 100644
(file)
--- a/
src/language/stats/frequencies.q
+++ b/
src/language/stats/frequencies.q
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007, 2009, 2010
, 2011
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-621,7
+621,7
@@
frq_custom_variables (struct lexer *lexer, struct dataset *ds,
lex_match (lexer, T_EQUALS);
if (lex_token (lexer) != T_ALL
&& (lex_token (lexer) != T_ID
lex_match (lexer, T_EQUALS);
if (lex_token (lexer) != T_ALL
&& (lex_token (lexer) != T_ID
- || dict_lookup_var (dataset_dict (ds), lex_tok
id
(lexer)) == NULL))
+ || dict_lookup_var (dataset_dict (ds), lex_tok
cstr
(lexer)) == NULL))
return 2;
/* Get list of current variables, to avoid duplicates. */
return 2;
/* Get list of current variables, to avoid duplicates. */
@@
-663,7
+663,8
@@
frq_custom_grouped (struct lexer *lexer, struct dataset *ds, struct cmd_frequenc
struct frq_proc *frq = frq_;
lex_match (lexer, T_EQUALS);
struct frq_proc *frq = frq_;
lex_match (lexer, T_EQUALS);
- if ((lex_token (lexer) == T_ID && dict_lookup_var (dataset_dict (ds), lex_tokid (lexer)) != NULL)
+ if ((lex_token (lexer) == T_ID
+ && dict_lookup_var (dataset_dict (ds), lex_tokcstr (lexer)) != NULL)
|| lex_token (lexer) == T_ID)
for (;;)
{
|| lex_token (lexer) == T_ID)
for (;;)
{
@@
-739,7
+740,7
@@
frq_custom_grouped (struct lexer *lexer, struct dataset *ds, struct cmd_frequenc
free (v);
if (!lex_match (lexer, T_SLASH))
break;
free (v);
if (!lex_match (lexer, T_SLASH))
break;
- if ((lex_token (lexer) != T_ID || dict_lookup_var (dataset_dict (ds), lex_tok
id
(lexer)) != NULL)
+ if ((lex_token (lexer) != T_ID || dict_lookup_var (dataset_dict (ds), lex_tok
cstr
(lexer)) != NULL)
&& lex_token (lexer) != T_ALL)
{
lex_put_back (lexer, T_SLASH);
&& lex_token (lexer) != T_ALL)
{
lex_put_back (lexer, T_SLASH);
@@
-921,8
+922,7
@@
calc_percentiles (const struct frq_proc *frq, const struct var_freqs *vf)
if (rank <= tp)
break;
if (rank <= tp)
break;
- if (f->count > 1
- && (rank - (f->count - 1) > tp || f + 1 >= ft->missing))
+ if (tp + 1 < rank || f + 1 >= ft->missing)
pc->value = f->value.f;
else
pc->value = calc_percentile (pc->p, W, f->value.f, f[1].value.f);
pc->value = f->value.f;
else
pc->value = calc_percentile (pc->p, W, f->value.f, f[1].value.f);