projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added variable/parameter matching and error reporting
[pspp]
/
src
/
percentiles.c
diff --git
a/src/percentiles.c
b/src/percentiles.c
index 1c8eef2aae518bfce94945fe8f1aa26fe164f042..2381f771d6457f627db2a3f4f0eebe893789bf30 100644
(file)
--- a/
src/percentiles.c
+++ b/
src/percentiles.c
@@
-15,13
+15,18
@@
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 5
9 Temple Place - Suite 330
, Boston, MA
-0211
1-1307
, USA. */
+Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+0211
0-1301
, USA. */
+#include <config.h>
#include "factor_stats.h"
#include "percentiles.h"
#include "misc.h"
#include "factor_stats.h"
#include "percentiles.h"
#include "misc.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
#include <assert.h>
#include <assert.h>
@@
-355,14
+360,22
@@
tukey_hinges(const struct weighted_value **wv,
for ( i = 0 ; i < 3 ; i++ )
{
for ( i = 0 ; i < 3 ; i++ )
{
- assert(h[i] + 1< n_data);
if ( h[i] >= 0 )
a_star = l[i] - wv[h[i]]->cc ;
else
a_star = l[i];
if ( h[i] >= 0 )
a_star = l[i] - wv[h[i]]->cc ;
else
a_star = l[i];
- a = a_star / ( wv[h[i]+1]->cc ) ;
+ if ( h[i] + 1 >= n_data )
+ {
+ assert( a_star < 1 ) ;
+ hinge[i] = (1 - a_star) * wv[h[i]]->v.f;
+ continue;
+ }
+ else
+ {
+ a = a_star / ( wv[h[i] + 1]->cc ) ;
+ }
if ( a_star >= 1.0 )
{
if ( a_star >= 1.0 )
{
@@
-370,15
+383,15
@@
tukey_hinges(const struct weighted_value **wv,
continue;
}
continue;
}
- if ( wv[h[i]
+
1]->w >= 1)
+ if ( wv[h[i]
+
1]->w >= 1)
{
{
- hinge[i] = ( 1 - a_star)* wv[h[i]]->v.f
- + a_star * wv[h[i]
+
1]->v.f;
+ hinge[i] = ( 1 - a_star)
* wv[h[i]]->v.f
+ + a_star * wv[h[i]
+
1]->v.f;
continue;
}
continue;
}
- hinge[i] = (
1 - a)* wv[h[i]]->v.f + a * wv[h[i]+
1]->v.f;
+ hinge[i] = (
1 - a) * wv[h[i]]->v.f + a * wv[h[i] +
1]->v.f;
}
}