|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Number
org.apfloat.Apcomplex
org.apfloat.Apfloat
org.apfloat.Aprational
org.apfloat.Apint
public class Apint
Arbitrary precision integer class.
In addition to the constructors, it is possible to create an apint
from an apfloat or aprational via the methods that round these
numbers to an integer value: Apfloat.floor(), Apfloat.ceil(),
and Apfloat.truncate().
| Field Summary |
|---|
| Fields inherited from class org.apfloat.Apcomplex |
|---|
DEFAULT, I, INFINITE, ONE, ZERO |
| Constructor Summary | |
|---|---|
protected |
Apint()
Default constructor. |
|
Apint(BigInteger value)
Constructs an apint from a BigInteger. |
|
Apint(BigInteger value,
int radix)
Constructs an apint from a BigInteger using the specified radix. |
|
Apint(long value)
Constructs an apfloat from the specified long. |
|
Apint(long value,
int radix)
Constructs an apfloat from the specified long
and radix. |
|
Apint(PushbackReader in)
Reads an apint from a stream using the default radix. |
|
Apint(PushbackReader in,
int radix)
Reads an apint from a stream using the specified radix. |
|
Apint(String value)
Constructs an apfloat from the specified string. |
|
Apint(String value,
int radix)
Constructs an apfloat from the specified string and radix. |
| Method Summary | |
|---|---|
Apint |
add(Apint x)
Adds two apints. |
Apint |
ceil()
Ceiling function. |
int |
compareTo(Apfloat x)
Compare this apint to the specified apfloat. |
int |
compareTo(Apint x)
Compare this apint to the specified apint. |
int |
compareTo(Aprational x)
Compare this apint to the specified aprational. |
Apint |
denominator()
Denominator of this aprational. |
Apint |
divide(Apint x)
Divides two apints. |
boolean |
equals(Object obj)
Compares this object to the specified object. |
Apint |
floor()
Floor function. |
void |
formatTo(Formatter formatter,
int flags,
int width,
int precision)
Formats the object using the provided formatter. |
protected ApfloatImpl |
getImpl(long precision)
Returns an ApfloatImpl representing this apint up to the requested precision. |
int |
hashCode()
Returns a hash code for this apint. |
boolean |
isShort()
Returns if this apint is "short". |
Apint |
mod(Apint x)
Calculates the remainder when divided by an apint. |
Apint |
multiply(Apint x)
Multiplies two apints. |
Apint |
negate()
Negative value. |
Apint |
numerator()
Numerator of this aprational. |
int |
radix()
Radix of this apint. |
long |
scale()
Returns the scale of this apint. |
int |
signum()
Returns the signum function of this apint. |
Apint |
subtract(Apint x)
Subtracts two apints. |
Apint |
toRadix(int radix)
Convert this apint to the specified radix. |
String |
toString(boolean pretty)
Returns a string representation of this aprational. |
Apint |
truncate()
Truncates fractional part. |
void |
writeTo(Writer out,
boolean pretty)
Write a string representation of this aprational to a Writer. |
| Methods inherited from class org.apfloat.Aprational |
|---|
add, divide, mod, multiply, precision, subtract, toString, writeTo |
| Methods inherited from class org.apfloat.Apfloat |
|---|
add, byteValue, divide, doubleValue, equalDigits, floatValue, imag, intValue, longValue, mod, multiply, precision, real, shortValue, subtract |
| Methods inherited from class org.apfloat.Apcomplex |
|---|
add, conj, divide, equalDigits, multiply, subtract |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Apint()
public Apint(String value)
throws NumberFormatException,
ApfloatRuntimeException
value - The string representing the number.
NumberFormatException - In case the number is invalid.
ApfloatRuntimeException
public Apint(String value,
int radix)
throws NumberFormatException,
ApfloatRuntimeException
value - The string representing the number.radix - The radix of the number.
NumberFormatException - In case the number is invalid.
ApfloatRuntimeException
public Apint(long value)
throws NumberFormatException,
ApfloatRuntimeException
long.
The default radix will be used.
value - The value of the number.
NumberFormatException - In case the number is invalid.
ApfloatRuntimeException
public Apint(long value,
int radix)
throws NumberFormatException,
ApfloatRuntimeException
long
and radix.
value - The value of the number.radix - The radix of the number.
NumberFormatException - In case the number is invalid.
ApfloatRuntimeException
public Apint(PushbackReader in)
throws IOException,
NumberFormatException,
ApfloatRuntimeException
in - The stream to read from
IOException - If an I/O error occurs accessing the stream.
NumberFormatException - If the number is not valid.
ApfloatRuntimeException
public Apint(PushbackReader in,
int radix)
throws IOException,
NumberFormatException,
ApfloatRuntimeException
in - The stream to read fromradix - The radix of the number.
IOException - If an I/O error occurs accessing the stream.
NumberFormatException - If the number is not valid.
ApfloatRuntimeException
public Apint(BigInteger value)
throws NumberFormatException,
ApfloatRuntimeException
BigInteger. The default radix is used.
value - The value of the number.
NumberFormatException - If the default radix is not valid.
ApfloatRuntimeException
public Apint(BigInteger value,
int radix)
throws NumberFormatException,
ApfloatRuntimeException
BigInteger using the specified radix.
value - The value of the number.radix - The radix of the number.
NumberFormatException - If the radix is not valid.
ApfloatRuntimeException| Method Detail |
|---|
public Apint numerator()
numerator in class Aprationalthis.public Apint denominator()
denominator in class AprationalApcomplex.ONE.public int radix()
radix in class Aprational
public long scale()
throws ApfloatRuntimeException
Zero has a scale of -INFINITE.
scale in class AprationalApfloatRuntimeExceptionApfloat.scale()public int signum()
signum in class Aprational
public boolean isShort()
throws ApfloatRuntimeException
isShort in class Aprationaltrue if the apint is "short", false if not.
ApfloatRuntimeExceptionApfloat.isShort()
public Apint negate()
throws ApfloatRuntimeException
negate in class Aprational-this.
ApfloatRuntimeException
public Apint add(Apint x)
throws ApfloatRuntimeException
x - The number to be added to this number.
this + x.
ApfloatRuntimeException
public Apint subtract(Apint x)
throws ApfloatRuntimeException
x - The number to be subtracted from this number.
this - x.
ApfloatRuntimeException
public Apint multiply(Apint x)
throws ApfloatRuntimeException
x - The number to be multiplied by this number.
this * x.
ApfloatRuntimeException
public Apint divide(Apint x)
throws ArithmeticException,
ApfloatRuntimeException
x - The number by which this number is to be divided.
this / x.
ArithmeticException - In case the divisor is zero.
ApfloatRuntimeException
public Apint mod(Apint x)
throws ApfloatRuntimeException
x is zero, then zero is returned.
x - The number that is used as the divisor in the remainder calculation.
this % x.
ApfloatRuntimeExceptionApfloatMath.fmod(Apfloat,Apfloat)public Apint floor()
floor in class Aprationalpublic Apint ceil()
ceil in class Aprationalpublic Apint truncate()
truncate in class Aprational
public Apint toRadix(int radix)
throws NumberFormatException,
ApfloatRuntimeException
toRadix in class Aprationalradix - The radix.
NumberFormatException - If the radix is invalid.
ApfloatRuntimeExceptionpublic int compareTo(Apint x)
x - Apint to which this apint is to be compared.
x.public int compareTo(Aprational x)
compareTo in class Aprationalx - Aprational to which this apint is to be compared.
x.public int compareTo(Apfloat x)
compareTo in interface Comparable<Apfloat>compareTo in class Aprationalx - Apfloat to which this apint is to be compared.
x.public boolean equals(Object obj)
Note: if two apfloats are compared where one number doesn't have enough
precise digits, the mantissa is assumed to contain zeros.
See Apfloat.compareTo(Apfloat).
equals in class Aprationalobj - The object to compare with.
true if the objects are the same; false otherwise.public int hashCode()
hashCode in class Aprational
public String toString(boolean pretty)
throws ApfloatRuntimeException
toString in class Aprationalpretty - true to use a fixed-point notation, false to use an exponential notation.
ApfloatRuntimeException
public void writeTo(Writer out,
boolean pretty)
throws IOException,
ApfloatRuntimeException
Writer.
writeTo in class Aprationalout - The output Writer.pretty - true to use a fixed-point notation, false to use an exponential notation.
IOException - In case of I/O error writing to the stream.
ApfloatRuntimeException
public void formatTo(Formatter formatter,
int flags,
int width,
int precision)
Aprational
formatTo in interface FormattableformatTo in class Aprationalformatter - The formatter.flags - The flags to modify the output format.width - The minimum number of characters to be written to the output, or -1 for no minimum.precision - The maximum number of characters to be written to the output, or -1 for no maximum.Apfloat.formatTo(Formatter,int,int,int)
protected ApfloatImpl getImpl(long precision)
throws ApfloatRuntimeException
ApfloatImpl representing this apint up to the requested precision.
getImpl in class Aprationalprecision - Precision of the ApfloatImpl that is needed.
ApfloatImpl representing this object to the requested precision.
ApfloatRuntimeException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||