6 Commits
Author SHA1 Message Date
dualfroz 4bf1fbf3b8 fix: propagate error from Quartile for inputs too small for quartiles
Quartile computed the median of empty slices for inputs with fewer than
three elements and discarded the resulting error, returning NaN quartiles
with a nil error. The silent NaN then leaked into InterQuartileRange,
Midhinge and Trimean. Propagate the error instead, mirroring the existing
EmptyInputErr handling.
2026-09-04 02:56:39 +02:00
upstream bc246e8d16 Upstream montanaflynn/stats state of the touched files before e61f9a13db 2026-09-04 02:56:39 +02:00
dualfroz 85d956c08c fix: propagate error from Quartile for inputs too small for quartiles
Quartile computed the median of empty slices for inputs with fewer than
three elements and discarded the resulting error, returning NaN quartiles
with a nil error. The silent NaN then leaked into InterQuartileRange,
Midhinge and Trimean. Propagate the error instead, mirroring the existing
EmptyInputErr handling.
2026-09-06 00:42:21 +02:00
upstream f9994fd0aa Upstream montanaflynn/stats state of the touched files before a9577323b0 2026-09-04 02:56:39 +02:00
dualfroz 62beb61195 fix: return the value as all three quartiles for single-element input
Quartile called Median on empty half-slices when the input held one value
and discarded both errors, so it returned {NaN, v, NaN} with a nil error.
The NaN spread silently through InterQuartileRange, Midhinge and Trimean.

A single observation is its own lower hinge, median and upper hinge, which
is what Percentile already returns for the same data. Return that instead,
and note why the remaining discarded Median errors cannot fire.
2026-09-03 14:05:13 +02:00
upstream 05657cd5a8 Upstream montanaflynn/stats state of the touched files before 9ead4dd879 2026-09-03 14:05:13 +02:00