Files
PhpSpreadsheet/tests/data/Calculation/Statistical/CHITEST.php
T
gaoflow e88cd615cc Fix incomplete gamma convergence for GAMMA.DIST / CHISQ.DIST
The incomplete gamma primitive used a fixed 32-term power series with no
convergence test, so GAMMA.DIST, GAMMADIST, CHISQ.DIST(.RT), GAMMAINV and
CHISQ.INV were grossly wrong once the series argument reached ~32
(e.g. CHISQ.DIST.RT(80, 4) returned 0.806 instead of 1.74e-16).

Replace it with the standard convergence-tested regularized incomplete
gamma: series P(a,x) for x < a+1, continued fraction Q(a,x) for x >= a+1.
CHISQ.DIST.RT now uses Q directly so the right tail stays free of
1 - P cancellation. Consolidates the duplicate copy that already existed
privately in ChiSquared onto the shared primitive.
2026-08-04 08:25:36 +02:00

42 lines
779 B
PHP

<?php
declare(strict_types=1);
return [
[
0.0152703571482,
[[112, 76], [85, 95]],
[[100, 85], [70, 90]],
],
[
0.0003081920170083,
[[58, 35], [11, 25], [10, 23]],
[[45.35, 47.65], [17.56, 18.44], [16.09, 16.91]],
],
[
0.015888560447,
[[58], [11], [10]],
[[45.35], [17.56], [16.09]],
],
[
0.008682970191,
[[58, 35]],
[[45.35, 47.65]],
],
[
'#NUM!',
[[58, 11], [10, 35], [25]],
[[45.35, 17.56], [16.09, 47.65], [18.44, 16.91]],
],
[
'#DIV/0!',
[[112, 76], [85, 95]],
[[100, 0], [70, 90]],
],
[
'#NUM!',
[[112, 76], [85, 95]],
[[100, 85], [-70, 90]],
],
];