public class MpqScalar extends Scalar implements java.lang.Cloneable, java.io.Serializable
Mpq
multi-precision
rational.
Note: infinities are represented by using a null denominator.
This may cause problems if manipulated by Mpq
functions.
Constructor and Description |
---|
MpqScalar()
Creates a new Mpq Scalar set to 0.
|
MpqScalar(java.math.BigInteger x)
Creates a new Mpq Scalar initialized to x.
|
MpqScalar(java.math.BigInteger num,
java.math.BigInteger den)
Creates a new Mpq Scalar initialized to the fraction num/den.
|
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.
|
MpqScalar(Mpq x)
Creates a new Mpq Scalar holding a copy of x.
|
MpqScalar(MpqScalar x)
Creates a copy of x.
|
MpqScalar(Mpz x)
Creates a new Mpq Scalar holding a copy of x.
|
MpqScalar(Mpz num,
Mpz den)
Creates a new Mpq Scalar initialized to the fraction num/den.
|
Modifier and Type | Method and Description |
---|---|
MpqScalar |
clone()
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 |
cmp(MpqScalar x)
Returns -1, 0, 1 if this is respectively strictly smaller, equal, or
strictly greater than x.
|
int |
cmp(Scalar x)
Returns -1, 0, 1 if this is respectively strictly smaller, equal, or
strictly greater than x.
|
MpqScalar |
copy()
Creates a copy of the Scalar, of the same kind.
|
Mpq |
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 |
isEqual(MpqScalar x)
Whether this and x have the same value.
|
boolean |
isEqual(Scalar x)
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(java.math.BigInteger x)
Sets this to x.
|
void |
set(java.math.BigInteger num,
java.math.BigInteger den)
Sets this to the fraction num/den.
|
void |
set(int x)
Sets this to x.
|
void |
set(int num,
int den)
Sets this to the fraction num/den.
|
void |
set(Mpq x)
Copies the value of x into this.
|
void |
set(MpqScalar x)
Copies the value of x into this.
|
void |
set(Mpz x)
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[0] (with rounding).
|
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).
|
java.lang.String |
toString()
Returns a string representation of the value of this.
|
public Mpq val
public MpqScalar()
public MpqScalar(MpqScalar x)
public MpqScalar(Mpq x)
public MpqScalar(Mpz x)
public MpqScalar(int x)
public MpqScalar(int num, int den)
public MpqScalar(Mpz num, Mpz den)
public MpqScalar(java.math.BigInteger x)
public MpqScalar(java.math.BigInteger num, java.math.BigInteger den)
public MpqScalar copy()
Scalar
public void set(MpqScalar x)
public void set(Mpq x)
public void set(Mpz x)
public void set(int num, int den)
public void set(java.math.BigInteger x)
public void set(java.math.BigInteger num, java.math.BigInteger den)
public void setInfty(int sign)
The result is +oo if sign is strictly positive, -oo if sign is strictly negative, 0 if sign is null.
public Mpq get()
public int toMpq(Mpq r, int round)
public int toMpfr(Mpfr r, int round)
public int toDouble(double[] r, int round)
public java.lang.String toString()
public int hashCode()
public int isInfty()
public int cmp(MpqScalar x)
public int cmp(Scalar x)
public int cmp(int x)
public boolean isEqual(MpqScalar x)
public boolean isEqual(Scalar x)
public boolean isEqual(int x)
public MpqScalar clone()
clone
in class java.lang.Object