src/Chippyash/Math/Type/Calculator/Native.php
public function rationalPow(RationalType $a, NI $exp)
    {
        if ($exp instanceof ComplexType) {
            $r = $this->floatComplexPow($a(), $exp);
            if ($r instanceof FloatType) {
                return RationalTypeFactory::fromFloat($r());
            }
            return $r;
        }

        $exp2 = $exp->get();
        $numF = pow($a->numerator()->get(), $exp2);
        $denF = pow($a->denominator()->get(), $exp2);
        $numR = RationalTypeFactory::fromFloat($numF);
        $denR = RationalTypeFactory::fromFloat($denF);

        return $this->rationalDiv($numR, $denR);
    }
public function rationalPow(RationalType $a, NI $exp)
    {
        if ($exp instanceof ComplexType) {
            $r = $this->floatComplexPow($a(), $exp);
            if ($r instanceof FloatType) {
                return RationalTypeFactory::fromFloat($r());
            }
            return $r;
        }

        $exp2 = $exp->get();
        $numF = pow($a->numerator()->get(), $exp2);
        $denF = pow($a->denominator()->get(), $exp2);
        $numR = RationalTypeFactory::fromFloat($numF);
        $denR = RationalTypeFactory::fromFloat($denF);

        return $this->rationalDiv($numR, $denR);
    }
public function rationalPow ( RationalType $ a , NI $ exp ) { if ( $ exp instanceof ComplexType ) { $ r = $ this -> floatComplexPow ( $ a ( ) , $ exp ) ; if ( $ r instanceof FloatType ) { return RationalTypeFactory :: fromFloat ( $ r ( ) ) ; } return $ r ; } $ exp2 = $ exp -> get ( ) ; $ numF = pow ( $ a -> numerator ( ) -> get ( ) , $ exp2 ) ; $ denF = pow ( $ a -> denominator ( ) -> get ( ) , $ exp2 ) ; $ numR = RationalTypeFactory :: fromFloat ( $ numF ) ; $ denR = RationalTypeFactory :: fromFloat ( $ denF ) ; return $ this -> rationalDiv ( $ numR , $ denR ) ; }
Rational Pow - raise number to the exponent
Will return a RationalType

@param RationalType $a operand
@param NI $exp exponent

@return NI
Rational Pow - raise number to the exponent Will return a RationalType