Package apron
Class MpqScalar
java.lang.Object
apron.Coeff
apron.Scalar
apron.MpqScalar
- All Implemented Interfaces:
Serializable
,Cloneable
Class of Scalar objects backed up by a
Mpq
multi-precision
rational.
Note: infinities are represented by using a null denominator.
This may cause problems if manipulated by Mpq
functions.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Mpq Scalar set to 0.MpqScalar
(int x) Creates a new Mpq Scalar initialized to x.MpqScalar
(int num, int den) Creates a new Mpq Scalar initialized to the fraction num/den.Creates a copy of x.Creates a new Mpq Scalar holding a copy of x.Creates a new Mpq Scalar holding a copy of x.Creates a new Mpq Scalar initialized to the fraction num/den.Creates a new Mpq Scalar initialized to x.MpqScalar
(BigInteger num, BigInteger den) Creates a new Mpq Scalar initialized to the fraction num/den. -
Method Summary
Modifier and TypeMethodDescriptionclone()
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.copy()
Creates a copy of the Scalar, of the same kind.get()
Returns the underlying Mpq.int
hashCode()
Returns a hash of the value of this.void
inv()
Inverts this (exact).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
isInfty()
Returns -1, 0 or 1 if this is respectively -oo, finite, or +oo.boolean
isZero()
Whether this equals 0.void
neg()
Negates this (exact).void
set
(int x) Sets this to x.void
set
(int num, int den) Sets this to the fraction num/den.void
Copies the value of x into this.void
Copies the value of x into this.void
Copies the value of x into this.void
set
(BigInteger x) Sets this to x.void
set
(BigInteger num, BigInteger den) Sets this to the fraction num/den.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[0] (with rounding).int
Copies the value of this into r (with rounding).int
Copies the value of this into r (exact).toString()
Returns a string representation of the value of this.
-
Field Details
-
val
The (mutable) scalar value.
-
-
Constructor Details
-
MpqScalar
public MpqScalar()Creates a new Mpq Scalar set to 0. -
MpqScalar
Creates a copy of x. -
MpqScalar
Creates a new Mpq Scalar holding a copy of x. -
MpqScalar
Creates a new Mpq Scalar holding a copy of x. -
MpqScalar
public MpqScalar(int x) Creates a new Mpq Scalar initialized to x. -
MpqScalar
public MpqScalar(int num, int den) Creates a new Mpq Scalar initialized to the fraction num/den. -
MpqScalar
Creates a new Mpq Scalar initialized to the fraction num/den. -
MpqScalar
Creates a new Mpq Scalar initialized to x. -
MpqScalar
Creates a new Mpq Scalar initialized to the fraction num/den.
-
-
Method Details
-
copy
Description copied from class:Scalar
Creates a copy of the Scalar, of the same kind. -
set
Copies the value of x into this. -
set
Copies the value of x into this. -
set
Copies the value of x into this. -
set
public void set(int x) Sets this to x. -
set
public void set(int num, int den) Sets this to the fraction num/den. -
set
Sets this to x. -
set
Sets this to the fraction num/den. -
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 Mpq. -
toMpq
Copies the value of this into r (exact). -
toMpfr
Copies the value of this into r (with rounding). -
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
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. -
isEqual
Whether this and x have the same value. -
isEqual
Whether this and x have the same value. -
isEqual
public boolean isEqual(int x) 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 (exact). -
clone
Returns a copy of this.
-