private function buildQuartile(
        Number $percentage,
        ColumnVector $dataset
    ): Number {
        $dimension = $dataset->dimension();

        if ($dimension->value() === 2) {
            return divide(
                add($dataset->get(0), $dataset->get(1)),
                2
            );
        } else if ($dimension->value() === 1) {
            return $dataset->get(0);
        }

        $index = (int) $dimension
            ->multiplyBy($percentage)
            ->round()
            ->value();

        return divide(
            add($dataset->get($index), $dataset->get($index - 1)),
            2
        );
    }
private function buildQuartile(
        Number $percentage,
        ColumnVector $dataset
    ): Number {
        $dimension = $dataset->dimension();

        if ($dimension->value() === 2) {
            return divide(
                add($dataset->get(0), $dataset->get(1)),
                2
            );
        } else if ($dimension->value() === 1) {
            return $dataset->get(0);
        }

        $index = (int) $dimension
            ->multiplyBy($percentage)
            ->round()
            ->value();

        return divide(
            add($dataset->get($index), $dataset->get($index - 1)),
            2
        );
    }
private function buildQuartile ( Number $ percentage , ColumnVector $ dataset ) : Number { $ dimension = $ dataset -> dimension ( ) ; if ( $ dimension -> value ( ) === 2 ) { return divide ( add ( $ dataset -> get ( 0 ) , $ dataset -> get ( 1 ) ) , 2 ) ; } else if ( $ dimension -> value ( ) === 1 ) { return $ dataset -> get ( 0 ) ; } $ index = ( int ) $ dimension -> multiplyBy ( $ percentage ) -> round ( ) -> value ( ) ; return divide ( add ( $ dataset -> get ( $ index ) , $ dataset -> get ( $ index - 1 ) ) , 2 ) ; }
Return the value describing the the quartile at the given percentage

@param Number $percentage
@param ColumnVector $dataset

@return float
Return the value describing the the quartile at the given percentage