mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-29 08:28:45 +00:00
029f345987
* Extract Binomial Distribution functions from Statistical Replace the old MS algorithm for CRITBINOM() (which has now been replaced with te BINOM.INV() function) with a brute force approach - I'll look to refine it later. The MS algorithm is no longer documented, and the implementation produced erroneous results anyway * Exract the NEGBINOMDIST() function as well; still need to add a cumulative flag to support the additional argument for the newer NEGBINOM.DIST() function * Rationalise validation of probability arguments
32 lines
857 B
PHP
32 lines
857 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class BinomDistRangeTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerBINOMDISTRANGE
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testBINOMDISTRANGE($expectedResult, ...$args): void
|
|
{
|
|
$result = Statistical\Distributions\Binomial::range(...$args);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public function providerBINOMDISTRANGE()
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/BINOMDISTRANGE.php';
|
|
}
|
|
}
|