Package de.tilman_neumann.jml.powers
Class Pow2
- java.lang.Object
-
- de.tilman_neumann.jml.powers.Pow2
-
public class Pow2 extends Object
-
-
Constructor Summary
Constructors Constructor Description Pow2()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigDecimal
divPow2(BigDecimal x, int n)
Division by the n.th power of 2.static BigDecimal
mulPow2(BigDecimal x, int n)
Multiplication with the n.th power of 2.static BigDecimal
pow2(int n)
Power of 2 with integer exponent.
-
-
-
Method Detail
-
pow2
public static BigDecimal pow2(int n)
Power of 2 with integer exponent.- Parameters:
n
-- Returns:
- 2^n
-
mulPow2
public static BigDecimal mulPow2(BigDecimal x, int n)
Multiplication with the n.th power of 2.- Parameters:
x
-n
- Exponent- Returns:
- x*2^n
-
divPow2
public static BigDecimal divPow2(BigDecimal x, int n)
Division by the n.th power of 2.- Parameters:
x
-n
- Exponent- Returns:
- x/2^n
-
-