protected function _factorial()
    {
        if ($this->value == 0) {
            return new N(1);
        }

        if ($this->value < 0) {
            throw new \RuntimeException(
                'Cannot get factorial of negative number!'
            );
        }

        if (!$this->_decimal()->zero) {
            throw new \RuntimeException(
                'Cannot get factorial of non integer!'
            );
        }

        return new N(array_product(range(1, $this->value)));
    }
protected function _factorial()
    {
        if ($this->value == 0) {
            return new N(1);
        }

        if ($this->value < 0) {
            throw new \RuntimeException(
                'Cannot get factorial of negative number!'
            );
        }

        if (!$this->_decimal()->zero) {
            throw new \RuntimeException(
                'Cannot get factorial of non integer!'
            );
        }

        return new N(array_product(range(1, $this->value)));
    }
protected function _factorial ( ) { if ( $ this -> value == 0 ) { return new N ( 1 ) ; } if ( $ this -> value < 0 ) { throw new \ RuntimeException ( 'Cannot get factorial of negative number!' ) ; } if ( ! $ this -> _decimal ( ) -> zero ) { throw new \ RuntimeException ( 'Cannot get factorial of non integer!' ) ; } return new N ( array_product ( range ( 1 , $ this -> value ) ) ) ; }
Computes the factorial of current number.

Computes the factorial of current number, the product form 1 to current
integer number.

$n = new N(1);
echo $n->factorial; // 1
echo $n->incr->factorial; // 2
echo $n->incr->factorial; // 6
echo $n->incr->factorial; // 24
echo $n->incr->factorial; // 120
echo $n->incr->factorial; // 720

This method is the runtime part of magic getter `\Malenki\Bah\N::$factorial`;

@see S::$factorial The magic getter `S::$factorial`
@see S::$fact Magic getter alias `S::$fact`
@return N
@throws \RuntimeException If current number is negative or is not an
integer.
Computes the factorial of current number .