/// <summary> /// <para> /// Returns a <c>BigFraction</c> whose value is /// (this^exponent), returning the result in reduced form. /// </para> /// </summary> /// <param name="exponent">exponent to which this <c>BigFraction</c> is to be raised. /// </param> /// <returns>this^exponent as a <c>BigFraction</c>.</returns> public BigFraction pow(long exponent) { if (exponent < 0) { return(new BigFraction(ArithmeticUtils.pow(denominator, -exponent), ArithmeticUtils.pow(numerator, -exponent))); } return(new BigFraction(ArithmeticUtils.pow(numerator, exponent), ArithmeticUtils.pow(denominator, exponent))); }
/// <summary> /// <para> /// Returns a <c>BigFraction</c> whose value is /// (this^exponent), returning the result in reduced form. /// </para> /// </summary> /// <param name="exponent">exponent to which this <c>BigFraction</c> is to be raised. /// </param> /// <returns>this^exponent as a <c>BigFraction</c>.</returns> public BigFraction pow(BigInteger exponent) { if (exponent.CompareTo(BigInteger.Zero) < 0) { BigInteger eNeg = BigInteger.Negate(exponent); return(new BigFraction(ArithmeticUtils.pow(denominator, eNeg), ArithmeticUtils.pow(numerator, eNeg))); } return(new BigFraction(ArithmeticUtils.pow(numerator, exponent), ArithmeticUtils.pow(denominator, exponent))); }