Class PowerImplementations

java.lang.Object
com.singularsys.extensions.field.implementations.PowerImplementations

public final class PowerImplementations extends Object
Fast static routines for calculating powers.
Since:
Jep 3.5 / Extensions 2.0
Author:
Richard Morris
  • Method Details

    • longpower

      public static long longpower(int l, int r)
    • intpower

      public static int intpower(int l, int r)
    • power

      public static double power(double l, double r)
    • power

      public static double power(double l, int n)
      A fast routine for computing integer powers. Code adapted from efficient power by Patricia Shanahan [email protected] Almost identical to the method Knuth gives on page 462 of The Art of Computer Programming Volume 2 Seminumerical Algorithms.
      Parameters:
      l - number to be taken to a power.
      n - power to take x to. 0 <= n <= Integer.MAX_VALUE Negative numbers will be treated as unsigned positives.
      Returns:
      x to the power n