Class Pow2

java.lang.Object
de.tilman_neumann.jml.powers.Pow2

public class Pow2
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    Pow2()  
  • Method Summary

    Modifier and Type Method Description
    static java.math.BigDecimal divPow2​(java.math.BigDecimal x, int n)
    Division by the n.th power of 2.
    static java.math.BigDecimal mulPow2​(java.math.BigDecimal x, int n)
    Multiplication with the n.th power of 2.
    static java.math.BigDecimal pow2​(int n)
    Power of 2 with integer exponent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Pow2

      public Pow2()
  • Method Details

    • pow2

      public static java.math.BigDecimal pow2​(int n)
      Power of 2 with integer exponent.
      Parameters:
      n -
      Returns:
      2^n
    • mulPow2

      public static java.math.BigDecimal mulPow2​(java.math.BigDecimal x, int n)
      Multiplication with the n.th power of 2.
      Parameters:
      x -
      n - Exponent
      Returns:
      x*2^n
    • divPow2

      public static java.math.BigDecimal divPow2​(java.math.BigDecimal x, int n)
      Division by the n.th power of 2.
      Parameters:
      x -
      n - Exponent
      Returns:
      x/2^n