java.lang.Cloneable
, java.lang.Comparable<BigSurd>
public class BigSurd extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable<BigSurd>
Modifier and Type | Field | Description |
---|---|---|
static BigSurd |
ONE |
The value of one.
|
static BigSurd |
ZERO |
The value of zero.
|
Constructor | Description |
---|---|
BigSurd() |
Default ctor, which represents the zero.
|
BigSurd(int a,
int b) |
ctor given the numerator and denominator of the root.
|
BigSurd(Rational a,
Rational b) |
ctor given the prefactor and the basis of the root.
|
BigSurd(java.math.BigInteger a) |
ctor given the value under the root.
|
Modifier and Type | Method | Description |
---|---|---|
BigSurd |
abs() |
Absolute value.
|
BigSurdVec |
add(BigSurd val) |
Add two surds of compatible discriminant.
|
java.math.BigDecimal |
BigDecimalValue(java.math.MathContext mc) |
Return the approximate floating point representation.
|
BigSurd |
clone() |
Create a deep copy.
|
int |
compareTo(BigSurd val) |
Compares the value of this with another constant.
|
BigSurd |
divide(int val) |
Divide by an integer.
|
BigSurd |
divide(BigSurd val) |
Divide by another square root.
|
BigSurd |
divide(java.math.BigInteger val) |
Divide by an integer.
|
double |
doubleValue() |
Return a double value representation.
|
float |
floatValue() |
Return a float value representation.
|
boolean |
isBigInteger() |
True if the value is integer.
|
boolean |
isRational() |
True if the value is rational.
|
BigSurd |
multiply(int val) |
Multiply by an integer.
|
BigSurd |
multiply(BigSurd val) |
Multiply by another square root.
|
BigSurd |
multiply(Rational val) |
Multiply by a rational number.
|
BigSurd |
multiply(java.math.BigInteger val) |
Multiply by a BigInteger.
|
BigSurd |
negate() |
Compute the negative.
|
protected void |
normalize() |
Normalize to squarefree discriminant.
|
protected void |
normalizeG() |
Normalize to coprime numerator and denominator in prefactor and discriminant
|
int |
signum() |
The sign: 1 if the number is >0, 0 if ==0, -1 if <0
|
Rational |
sqr() |
Compute the square.
|
Rational |
toRational() |
Convert to a rational value if possible
|
java.lang.String |
toString() |
Return a string in the format (number/denom)*()^(1/2).
|
public static BigSurd ZERO
public static BigSurd ONE
public BigSurd()
public BigSurd(Rational a, Rational b)
a
- the prefactor.b
- the discriminant.public BigSurd(int a, int b)
a
- the numeratorb
- the denominator.public BigSurd(java.math.BigInteger a)
a
- the discriminant.public BigSurd clone()
clone
in class java.lang.Object
public BigSurdVec add(BigSurd val)
val
- The value to be added to this.public BigSurd multiply(BigSurd val)
val
- a second number of this type.public BigSurd multiply(Rational val)
val
- the factor.public BigSurd multiply(java.math.BigInteger val)
val
- a second number.public BigSurd multiply(int val)
val
- a second number.public Rational sqr()
public BigSurd divide(BigSurd val)
val
- A second number of this type.public BigSurd divide(java.math.BigInteger val)
val
- a second number.public BigSurd divide(int val)
val
- A second number.public BigSurd negate()
public BigSurd abs()
public int compareTo(BigSurd val)
compareTo
in interface java.lang.Comparable<BigSurd>
val
- the other constant to compare withpublic java.lang.String toString()
toString
in class java.lang.Object
public double doubleValue()
public float floatValue()
public boolean isBigInteger()
public boolean isRational()
public Rational toRational()
public int signum()
protected void normalize()
protected void normalizeG()
public java.math.BigDecimal BigDecimalValue(java.math.MathContext mc)
mc
- Description of the accuracy needed.