Package apron
Class MpfrScalar
java.lang.Object
apron.Coeff
apron.Scalar
apron.MpfrScalar
- All Implemented Interfaces:
Serializable,Cloneable
Class of Scalar objects backed up by a
Mpfr
multi-precision floating-point number.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Mpfr Scalar set to NaN.MpfrScalar(double x, int round) Creates a new Mpfr Scalar holding a copy of x.MpfrScalar(int prec) Creates a new Mpfr Scalar with the given precision, set to NaN.Creates a copy of x.MpfrScalar(Mpfr x) Creates a new Mpfr Scalar holding a copy of x. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a copy of this.intcmp(int x) Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.intcmp(MpfrScalar x) Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.intReturns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x.copy()Creates a copy of the Scalar, of the same kind.get()Returns the underlying Mpfr.inthashCode()Returns a hash of the value of this.voidinv()Inverts this (with rounding).booleanisEqual(int x) Whether this and x have the same value.booleanWhether this and x have the same value.booleanWhether this and x have the same value.intisInfty()Returns -1, 0 or 1 if this is respectively -oo, finite, or +oo.booleanisZero()Whether this equals 0.voidneg()Negates this (exact).voidset(double x, int round) Copies the value of x into this.voidset(int x) Sets this to x.voidset(MpfrScalar x) Copies the value of x into this.voidCopies the value of x into this.voidCopies the value of x into this.voidsetInfty(int sign) Sets the scalar to +oo or -oo.intsgn()Returns the sign of this.inttoDouble(double[] r, int round) Copies the value of this into r[0] (with rounding).intCopies the value of this into r (exact).intCopies the value of this into r (exact, except if NaN)toString()Returns a string representation of the value of this.
-
Field Details
-
val
The (mutable) scalar value.
-
-
Constructor Details
-
MpfrScalar
public MpfrScalar()Creates a new Mpfr Scalar set to NaN. -
MpfrScalar
public MpfrScalar(int prec) Creates a new Mpfr Scalar with the given precision, set to NaN. -
MpfrScalar
Creates a copy of x. -
MpfrScalar
Creates a new Mpfr Scalar holding a copy of x. -
MpfrScalar
public MpfrScalar(double x, int round) Creates a new Mpfr Scalar holding a copy of x.x is rounded to the default Mpfr precision (see
gmp.Mpfr.setDefaultPrec) in the direction specified by round.
-
-
Method Details
-
copy
Description copied from class:ScalarCreates a copy of the Scalar, of the same kind. -
set
Copies the value of x into this.The precision of this is changed to match that of x.
-
set
Copies the value of x into this.The precision of this is changed to match that of x.
-
set
Copies the value of x into this.this retains its precision and x is rounded.
-
set
public void set(double x, int round) Copies the value of x into this.this retains its precision and x is rounded.
-
set
public void set(int x) Sets this to x. -
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.
-
get
Returns the underlying Mpfr. -
toMpq
Copies the value of this into r (exact, except if NaN) -
toMpfr
Copies the value of this into r (exact). -
toDouble
public int toDouble(double[] r, int round) Copies the value of this into r[0] (with rounding). -
toString
Returns a string representation of the value of this. -
hashCode
public int hashCode()Returns a hash of the value of this. -
isInfty
public int isInfty()Returns -1, 0 or 1 if this is respectively -oo, finite, or +oo. -
isZero
public boolean isZero()Whether this equals 0. -
cmp
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. -
cmp
Returns -1, 0, 1 if this is respectively strictly smaller, equal, or strictly greater than x. -
isEqual
Whether this and x have the same value. -
isEqual
public boolean isEqual(int x) Whether this and x have the same value. -
isEqual
Whether this and x have the same value. -
sgn
public int sgn()Returns the sign of this. -
neg
public void neg()Negates this (exact). -
inv
public void inv()Inverts this (with rounding). -
clone
Returns a copy of this.
-