Class PowerImplementations
- java.lang.Object
-
- com.singularsys.extensions.field.implementations.PowerImplementations
-
public final class PowerImplementations extends java.lang.Object
Fast static routines for calculating powers.- Since:
- Jep 3.5 / Extensions 2.0
- Author:
- Richard Morris
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
intpower(int l, int r)
static long
longpower(int l, int r)
static double
power(double l, double r)
static double
power(double l, int n)
A fast routine for computing integer powers.
-
-
-
Method Detail
-
longpower
public static final long longpower(int l, int r)
-
intpower
public static final int intpower(int l, int r)
-
power
public static final double power(double l, double r)
-
power
public static final 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
-
-