Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php
public static function TDIST($value, $degrees, $tails)
    {
        $value = Functions::flattenSingleValue($value);
        $degrees = floor(Functions::flattenSingleValue($degrees));
        $tails = floor(Functions::flattenSingleValue($tails));

        if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) {
            if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) {
                return Functions::NAN();
            }
            //    tdist, which finds the probability that corresponds to a given value
            //    of t with k degrees of freedom. This algorithm is translated from a
            //    pascal function on p81 of "Statistical Computing in Pascal" by D
            //    Cooke, A H Craven & G M Clark (1985: Edward Arnold (Pubs.) Ltd:
            //    London). The above Pascal algorithm is itself a translation of the
            //    fortran algoritm "AS 3" by B E Cooper of the Atlas Computer
            //    Laboratory as reported in (among other places) "Applied Statistics
            //    Algorithms", editied by P Griffiths and I D Hill (1985; Ellis
            //    Horwood Ltd.; W. Sussex, England).
            $tterm = $degrees;
            $ttheta = atan2($value, sqrt($tterm));
            $tc = cos($ttheta);
            $ts = sin($ttheta);
            $tsum = 0;

            if (($degrees % 2) == 1) {
                $ti = 3;
                $tterm = $tc;
            } else {
                $ti = 2;
                $tterm = 1;
            }

            $tsum = $tterm;
            while ($ti < $degrees) {
                $tterm *= $tc * $tc * ($ti - 1) / $ti;
                $tsum += $tterm;
                $ti += 2;
            }
            $tsum *= $ts;
            if (($degrees % 2) == 1) {
                $tsum = Functions::M_2DIVPI * ($tsum + $ttheta);
            }
            $tValue = 0.5 * (1 + $tsum);
            if ($tails == 1) {
                return 1 - abs($tValue);
            }

            return 1 - abs((1 - $tValue) - $tValue);
        }

        return Functions::VALUE();
    }
public static function TDIST($value, $degrees, $tails)
    {
        $value = Functions::flattenSingleValue($value);
        $degrees = floor(Functions::flattenSingleValue($degrees));
        $tails = floor(Functions::flattenSingleValue($tails));

        if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) {
            if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) {
                return Functions::NAN();
            }
            //    tdist, which finds the probability that corresponds to a given value
            //    of t with k degrees of freedom. This algorithm is translated from a
            //    pascal function on p81 of "Statistical Computing in Pascal" by D
            //    Cooke, A H Craven & G M Clark (1985: Edward Arnold (Pubs.) Ltd:
            //    London). The above Pascal algorithm is itself a translation of the
            //    fortran algoritm "AS 3" by B E Cooper of the Atlas Computer
            //    Laboratory as reported in (among other places) "Applied Statistics
            //    Algorithms", editied by P Griffiths and I D Hill (1985; Ellis
            //    Horwood Ltd.; W. Sussex, England).
            $tterm = $degrees;
            $ttheta = atan2($value, sqrt($tterm));
            $tc = cos($ttheta);
            $ts = sin($ttheta);
            $tsum = 0;

            if (($degrees % 2) == 1) {
                $ti = 3;
                $tterm = $tc;
            } else {
                $ti = 2;
                $tterm = 1;
            }

            $tsum = $tterm;
            while ($ti < $degrees) {
                $tterm *= $tc * $tc * ($ti - 1) / $ti;
                $tsum += $tterm;
                $ti += 2;
            }
            $tsum *= $ts;
            if (($degrees % 2) == 1) {
                $tsum = Functions::M_2DIVPI * ($tsum + $ttheta);
            }
            $tValue = 0.5 * (1 + $tsum);
            if ($tails == 1) {
                return 1 - abs($tValue);
            }

            return 1 - abs((1 - $tValue) - $tValue);
        }

        return Functions::VALUE();
    }
public static function TDIST ( $ value , $ degrees , $ tails ) { $ value = Functions :: flattenSingleValue ( $ value ) ; $ degrees = floor ( Functions :: flattenSingleValue ( $ degrees ) ) ; $ tails = floor ( Functions :: flattenSingleValue ( $ tails ) ) ; if ( ( is_numeric ( $ value ) ) && ( is_numeric ( $ degrees ) ) && ( is_numeric ( $ tails ) ) ) { if ( ( $ value < 0 ) || ( $ degrees < 1 ) || ( $ tails < 1 ) || ( $ tails > 2 ) ) { return Functions :: NAN ( ) ; } //    tdist, which finds the probability that corresponds to a given value //    of t with k degrees of freedom. This algorithm is translated from a //    pascal function on p81 of "Statistical Computing in Pascal" by D //    Cooke, A H Craven & G M Clark (1985: Edward Arnold (Pubs.) Ltd: //    London). The above Pascal algorithm is itself a translation of the //    fortran algoritm "AS 3" by B E Cooper of the Atlas Computer //    Laboratory as reported in (among other places) "Applied Statistics //    Algorithms", editied by P Griffiths and I D Hill (1985; Ellis //    Horwood Ltd.; W. Sussex, England). $ tterm = $ degrees ; $ ttheta = atan2 ( $ value , sqrt ( $ tterm ) ) ; $ tc = cos ( $ ttheta ) ; $ ts = sin ( $ ttheta ) ; $ tsum = 0 ; if ( ( $ degrees % 2 ) == 1 ) { $ ti = 3 ; $ tterm = $ tc ; } else { $ ti = 2 ; $ tterm = 1 ; } $ tsum = $ tterm ; while ( $ ti < $ degrees ) { $ tterm *= $ tc * $ tc * ( $ ti - 1 ) / $ ti ; $ tsum += $ tterm ; $ ti += 2 ; } $ tsum *= $ ts ; if ( ( $ degrees % 2 ) == 1 ) { $ tsum = Functions :: M_2DIVPI * ( $ tsum + $ ttheta ) ; } $ tValue = 0.5 * ( 1 + $ tsum ) ; if ( $ tails == 1 ) { return 1 - abs ( $ tValue ) ; } return 1 - abs ( ( 1 - $ tValue ) - $ tValue ) ; } return Functions :: VALUE ( ) ; }
TDIST.

Returns the probability of Student's T distribution.

@param float $value Value for the function
@param float $degrees degrees of freedom
@param float $tails number of tails (1 or 2)

@return float
TDIST .