Class Pow2


  • public class Pow2
    extends Object
    • Constructor Detail

      • Pow2

        public Pow2()
    • 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