Package apron

Class DoubleScalar

All Implemented Interfaces:
Serializable, Cloneable

public class DoubleScalar extends Scalar implements Cloneable, Serializable
Class of Scalar objects backed up by a double-precision floating-point number.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The (mutable) scalar value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new double Scalar set to 0.
    DoubleScalar(double x)
    Creates a new double Scalar initialized to x.
    Creates a copy of x.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a copy of this.
    int
    cmp(int x)
    Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.
    int
    Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.
    int
    Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.
    Creates a copy of the Scalar, of the same kind.
    double
    get()
    Returns the underlying double.
    int
    Returns a hash of the value of this.
    void
    inv()
    Inverts this (with rounding).
    boolean
    isEqual(int x)
    Whether this and x have the same value.
    boolean
    Whether this and x have the same value.
    boolean
    Whether this and x have the same value.
    int
    Returns -1, 0 or 1 if this is respectively -oo, finite, or +oo.
    boolean
    Whether this equals 0.
    void
    neg()
    Negates this (exact).
    void
    set(double x)
    Copies the value of x into this.
    void
    set(int x)
    Sets this to x.
    void
    Copies the value of x into this.
    void
    setInfty(int sign)
    Sets the scalar to +oo or -oo.
    int
    sgn()
    Returns the sign of this.
    int
    toDouble(double[] r, int round)
    Copies the value of this into r (exact).
    int
    toMpfr(Mpfr r, int round)
    Copies the value of this into r (with rounding).
    int
    toMpq(Mpq r, int round)
    Copies the value of this into r (exact, except if NaN).
    Returns a string representation of the value of this.

    Methods inherited from class apron.Scalar

    cmp, create, inf, isEqual, isScalar, sup

    Methods inherited from class apron.Coeff

    equals

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • val

      public double val
      The (mutable) scalar value.
  • Constructor Details

    • DoubleScalar

      public DoubleScalar()
      Creates a new double Scalar set to 0.
    • DoubleScalar

      public DoubleScalar(DoubleScalar x)
      Creates a copy of x.
    • DoubleScalar

      public DoubleScalar(double x)
      Creates a new double Scalar initialized to x.
  • Method Details

    • copy

      public DoubleScalar copy()
      Description copied from class: Scalar
      Creates a copy of the Scalar, of the same kind.
      Specified by:
      copy in class Scalar
    • set

      public void set(DoubleScalar x)
      Copies the value of x into this.
    • set

      public void set(double x)
      Copies the value of x into this.
    • set

      public void set(int x)
      Sets this to x.
      Specified by:
      set in class Scalar
    • setInfty

      public void setInfty(int sign)
      Sets the scalar to +oo or -oo.

      The result is +oo if sign is strictly positive, -oo if sign is strictly negative, 0 if sign is null.

      Specified by:
      setInfty in class Scalar
    • get

      public double get()
      Returns the underlying double.
    • toMpq

      public int toMpq(Mpq r, int round)
      Copies the value of this into r (exact, except if NaN).
      Specified by:
      toMpq in class Scalar
      Returns:
      0 (exact) or 1 (NaN).
    • toMpfr

      public int toMpfr(Mpfr r, int round)
      Copies the value of this into r (with rounding).
      Specified by:
      toMpfr in class Scalar
      Returns:
      -1, 0, 1 if the result is lower, exact, or greater than this.
    • toDouble

      public int toDouble(double[] r, int round)
      Copies the value of this into r (exact).
      Specified by:
      toDouble in class Scalar
      Returns:
      0.
    • toString

      public String toString()
      Returns a string representation of the value of this.
      Specified by:
      toString in class Scalar
    • hashCode

      public int hashCode()
      Returns a hash of the value of this.
      Specified by:
      hashCode in class Scalar
    • isInfty

      public int isInfty()
      Returns -1, 0 or 1 if this is respectively -oo, finite, or +oo.
      Specified by:
      isInfty in class Scalar
    • isZero

      public boolean isZero()
      Whether this equals 0.
      Specified by:
      isZero in class Scalar
    • cmp

      public int cmp(DoubleScalar x)
      Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.
    • cmp

      public int cmp(int x)
      Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.
      Specified by:
      cmp in class Scalar
    • cmp

      public int cmp(Scalar x)
      Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.
      Specified by:
      cmp in class Scalar
    • isEqual

      public boolean isEqual(DoubleScalar x)
      Whether this and x have the same value.
    • isEqual

      public boolean isEqual(int x)
      Whether this and x have the same value.
      Specified by:
      isEqual in class Scalar
    • isEqual

      public boolean isEqual(Scalar x)
      Whether this and x have the same value.
      Specified by:
      isEqual in class Scalar
    • sgn

      public int sgn()
      Returns the sign of this.
      Specified by:
      sgn in class Scalar
    • neg

      public void neg()
      Negates this (exact).
      Specified by:
      neg in class Scalar
    • inv

      public void inv()
      Inverts this (with rounding).
      Specified by:
      inv in class Scalar
    • clone

      public DoubleScalar clone()
      Returns a copy of this.
      Overrides:
      clone in class Object