From 5d2044f51d79aa63799eb2a7cfc2937c7a4829cf Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 26 Sep 2021 16:53:38 +0200 Subject: [PATCH] Avoid numerical problems with missing weights on non-linear cases. * src/math/order-stats.c (order_stats_accumulate_idx): Ignore cases with missing weight values. --- src/math/order-stats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/math/order-stats.c b/src/math/order-stats.c index 1a4aef891a..e8e078f4b6 100644 --- a/src/math/order-stats.c +++ b/src/math/order-stats.c @@ -128,6 +128,9 @@ order_stats_accumulate_idx (struct order_stats **os, size_t nos, const double weight = wt_idx == -1 ? 1.0 : case_num_idx (cx, wt_idx); const double this_value = case_num_idx (cx, val_idx); + if (weight == SYSMIS) + continue; + /* The casereader MUST be sorted */ assert (this_value >= prev_value); @@ -169,4 +172,3 @@ order_stats_accumulate (struct order_stats **os, size_t nos, wv ? var_get_case_index (wv) : -1, var_get_case_index (var)); } - -- 2.30.2