mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-27 03:15:21 +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
808 B
PHP
32 lines
808 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class BinomInvTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerBINOMINV
|
|
*
|
|
* @param mixed $expectedResult
|
|
*/
|
|
public function testBINOMINV($expectedResult, ...$args): void
|
|
{
|
|
$result = Statistical::CRITBINOM(...$args);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public function providerBINOMINV()
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/BINOMINV.php';
|
|
}
|
|
}
|