Class Huge

java.lang.Object
convex.core.util.Huge

public class Huge extends Object
A 128-bit integer
  • Field Details

    • ZERO

      public static final Huge ZERO
    • ONE

      public static final Huge ONE
    • hi

      public final long hi
    • lo

      public final long lo
  • Method Details

    • create

      public static Huge create(long a)
      Creates a new Huge by sign extending a long to 128 bits
      Parameters:
      a - Any signed 64-bit long value
      Returns:
      New Huge instance
    • multiply

      public static Huge multiply(long a, long b)
      Creates a new Huge by multiplying two signed longs
      Parameters:
      a - Any signed 64-bit long value
      b - Any signed 64-bit long value
      Returns:
      Huge product of arguments
    • multiply

      public static Huge multiply(Huge a, long b)
      Creates a new Huge by multiplying a Huge with a signed long
      Parameters:
      a - Any signed 128-bit Huge value
      b - Any signed 64-bit long value
      Returns:
      Huge product of arguments
    • add

      public static Huge add(long a, long b)
      Creates a Huge by adding two signed longs
      Parameters:
      a - Any signed 64-bit long value
      b - Any signed 64-bit long value
      Returns:
      Huge sum of arguments
    • add

      public Huge add(long b)
      Creates a Huge by adding a long value to this Huge
      Parameters:
      b - Any signed 64-bit long value
      Returns:
      Huge sum of arguments
    • fusedMultiplyDivide

      public static Long fusedMultiplyDivide(long a, long b, long c)
      Performs a fused multiply and divide (a * b) / c. Handles cases where (a*b) would overflow a single 64-bit long.
      Parameters:
      a - First multiplicand
      b - Second multiplicand
      c - Divisor
      Returns:
      Result of operation, of null if result overflows a Long
    • add

      public Huge add(Huge b)
      Creates a Huge by adding another Huge
      Parameters:
      b - Any Huge value
      Returns:
      Huge sum of arguments
    • equals

      public boolean equals(Object a)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(Huge a)
      Tests if this Huge is equal to another Huge
      Parameters:
      a - Another Huge instance (must not be null)
      Returns:
      true is the Huge values are equal, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sub

      public Huge sub(Huge b)
    • negate

      public Huge negate()
      Negates this Huge value
      Returns:
      Huge negation of this value
    • mul

      public Huge mul(Huge b)