Calculates the fraction to some integer exponent

Ex: new Fraction(-1,2).pow(-3) => -8
434422
function(m) {

      if (m < 0) {
        return new Fraction((this['s'] * this["d"]) ** BigInt(-m), this["n"] ** BigInt(-m));
      } else {
        return new Fraction((this['s'] * this["n"]) ** BigInt(+m), this["d"] ** BigInt(+m));
      }
    }
493677
def multiply(self, p, e):
        

        if self._order:
            e %= self._order
        if p == self._infinity or e == 0:
            return self._infinity

        e3 = 3 * e
        i = _leftmost_bit(e3) >> 1
        result = p
        while i > 1:
            result += result
            if (e3 & i):
                v = [result, result+p]
            else:
                v = [result-p, result]
            result = v[0 if (e & i) else 1]
            i >>= 1

        return result
902797
def ceilpow2(n):
    """"""
    signif,exponent = frexp(n)
    if (signif < 0):
        return 1;
    if (signif == 0.5):
        exponent -= 1;
    return (1) << exponent;
401854
def safe_pow(base, exp):
    """"""
    if exp > MAX_EXPONENT:
        raise RuntimeError("Invalid exponent, max exponent is {}".format(MAX_EXPONENT))
    return base ** exp
186183
def factorial_recur(n, mod=None):
    """"""
    if not (isinstance(n, int) and n >= 0):
        raise ValueError("'n' must be a non-negative integer.")
    if mod is not None and not (isinstance(mod, int) and mod > 0):
        raise ValueError("'mod' must be a positive integer")
    if n == 0:
        return 1
    result = n * factorial(n - 1, mod)
    if mod:
        result %= mod
    return result
40814
public static double round(double x, int decimal) {
        if (decimal < 0) {
            return round(x / pow(10, -decimal)) * pow(10, -decimal);
        } else {
            return round(x * pow(10, decimal)) / pow(10, decimal);
        }
    }
33214
def _power(ctx, number, power):
    
    return decimal_pow(conversions.to_decimal(number, ctx), conversions.to_decimal(power, ctx))
1205467
def _round_frac(x, precision):
    
    if not np.isfinite(x) or x == 0:
        return x
    else:
        frac, whole = np.modf(x)
        if whole == 0:
            digits = -int(np.floor(np.log10(abs(frac)))) - 1 + precision
        else:
            digits = precision
        return np.around(x, digits)
491580
def factorial(n):
  
  if isinstance(n, float):
    if n.is_integer():
      n = int(n)
  if not isinstance(n, INT_TYPES):
    raise TypeError("Non-integer input (perhaps you need Euler Gamma "
                    "function or Gauss Pi function)")
  if n < 0:
    raise ValueError("Input shouldn't be negative")
  return reduce(operator.mul,
                it.takewhile(lambda m: m <= n, it.count(2)),
                1)
791984
function exponent( x ) {
	// Convert `x` to an unsigned 32-bit integer corresponding to the IEEE 754 binary representation:
	var w = getWord( x );

	// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:
	w = ( w & EXP_MASK ) >>> 23;

	// Remove the bias and return:
	return w - BIAS;
}
1334554
function(value,i){
            i= Math.pow(10, i || 15);
            // default
            return Math.round(value*i)/i;
        }
114419
@Override
	public RandomVariable pow(double exponent) {
		return apply(new DoubleUnaryOperator() {
			@Override
			public double applyAsDouble(double x) {
				return FastMath.pow(x, exponent);
			}
		});
	}
886229
private static long calculateDivisor(long power10, int numZeros) {
        // We craft our divisor such that when we divide by it, we get a
        // number with the same number of digits as zeros found in the
        // plural variant templates. If our magnitude is 10000 and we have
        // two 0's in our plural variants, then we want a divisor of 1000.
        // Note that if we have 43560 which is of same magnitude as 10000.
        // When we divide by 1000 we a quotient which rounds to 44 (2 digits)
        long divisor = power10;
        for (int i = 1; i < numZeros; i++) {
            divisor /= 10;
        }
        return divisor;
    }
262494
public static Number power(Number self, Number exponent) {
        double base, exp, answer;
        base = self.doubleValue();
        exp = exponent.doubleValue();

        answer = Math.pow(base, exp);
        if ((double) ((int) answer) == answer) {
            return (int) answer;
        } else if ((double) ((long) answer) == answer) {
            return (long) answer;
        } else {
            return answer;
        }
    }
795709
public static <A extends Number & Comparable<?>> NumberExpression<Double> power(Expression<A> num, int exponent) {
        return Expressions.numberOperation(Double.class, Ops.MathOps.POWER, num, ConstantImpl.create(exponent));
    }
1253626
function(places) {

      places = Math.pow(10, places || 0);

      if (isNaN(this["n"]) || isNaN(this["d"])) {
        return new Fraction(NaN);
      }
      return new Fraction(Math.round(places * this["s"] * this["n"] / this["d"]), places);
    }
1074378
def chk_fraction_digits_arg(s):
    """"""
    try:
        v = int(s)
        if v >= 1 and v <= 18:
            return True
        else:
            return False
    except ValueError:
        return False