src/Chippyash/Math/Type/Calculator/Native.php
public function intPow(IntType $a, NI $exp)
    {
        if ($exp instanceof RationalType) {
            $b = new RationalType(clone $a, new IntType(1));
            return $this->rationalPow($b, $exp);
        }

        if ($exp instanceof ComplexType) {
            return $this->intComplexPow($a(), $exp);
        }

        //int and float types
        $p = pow($a(), $exp());
        if (($p - intval($p)) === 0) {
            return new IntType($p);
        }

        return RationalTypeFactory::fromFloat($p);
    }
public function intPow(IntType $a, NI $exp)
    {
        if ($exp instanceof RationalType) {
            $b = new RationalType(clone $a, new IntType(1));
            return $this->rationalPow($b, $exp);
        }

        if ($exp instanceof ComplexType) {
            return $this->intComplexPow($a(), $exp);
        }

        //int and float types
        $p = pow($a(), $exp());
        if (($p - intval($p)) === 0) {
            return new IntType($p);
        }

        return RationalTypeFactory::fromFloat($p);
    }
public function intPow ( IntType $ a , NI $ exp ) { if ( $ exp instanceof RationalType ) { $ b = new RationalType ( clone $ a , new IntType ( 1 ) ) ; return $ this -> rationalPow ( $ b , $ exp ) ; } if ( $ exp instanceof ComplexType ) { return $ this -> intComplexPow ( $ a ( ) , $ exp ) ; } //int and float types $ p = pow ( $ a ( ) , $ exp ( ) ) ; if ( ( $ p - intval ( $ p ) ) === 0 ) { return new IntType ( $ p ) ; } return RationalTypeFactory :: fromFloat ( $ p ) ; }
Integer Pow - raise number to the exponent
Will return an IntType, RationalType or ComplexType

@param IntType $a operand
@param NI $exp Exponent

@return NI
Integer Pow - raise number to the exponent Will return an IntType RationalType or ComplexType