Package org.apfloat.jscience
Class AprationalField
- All Implemented Interfaces:
Serializable
,Comparable<AprationalField>
,Immutable
,Realtime
,ValueType
,XMLSerializable
,Field<AprationalField>
,GroupAdditive<AprationalField>
,GroupMultiplicative<AprationalField>
,Ring<AprationalField>
,Structure<AprationalField>
This class represents an arbitrary precision rational number.
- Since:
- 1.8.0
- Version:
- 1.8.0
- Author:
- Mikko Tommila
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAprationalField
(Aprational value) Constructs a new rational field object with the specified value. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a copy of this object.inverse()
Returns the multiplicative inverse of this object.opposite()
Returns the additive inverse of this object.plus
(AprationalField that) Returns the sum of this object with the one specified.times
(AprationalField that) Returns the product of this object with the one specified.Methods inherited from class org.apfloat.jscience.AbstractField
compareTo, doubleValue, equals, hashCode, isLargerThan, longValue, toText, value
Methods inherited from class org.jscience.mathematics.number.Number
byteValue, floatValue, intValue, isGreaterThan, isLessThan, minus, pow, shortValue, toString
-
Constructor Details
-
AprationalField
Constructs a new rational field object with the specified value.- Parameters:
value
- The value.
-
-
Method Details
-
plus
Description copied from class:AbstractField
Returns the sum of this object with the one specified.- Specified by:
plus
in interfaceGroupAdditive<AprationalField>
- Specified by:
plus
in classAbstractField<AprationalField,
Aprational> - Parameters:
that
- The addend.- Returns:
this + that
-
opposite
Description copied from class:AbstractField
Returns the additive inverse of this object.- Specified by:
opposite
in interfaceGroupAdditive<AprationalField>
- Specified by:
opposite
in classAbstractField<AprationalField,
Aprational> - Returns:
-this
-
times
Description copied from class:AbstractField
Returns the product of this object with the one specified.- Specified by:
times
in interfaceGroupMultiplicative<AprationalField>
- Specified by:
times
in interfaceRing<AprationalField>
- Specified by:
times
in classAbstractField<AprationalField,
Aprational> - Parameters:
that
- The multiplicand.- Returns:
this * that
-
inverse
Description copied from class:AbstractField
Returns the multiplicative inverse of this object.- Specified by:
inverse
in interfaceGroupMultiplicative<AprationalField>
- Specified by:
inverse
in classAbstractField<AprationalField,
Aprational> - Returns:
1 / this
- Throws:
ArithmeticException
- If the divisor is zero.
-
copy
Description copied from class:AbstractField
Returns a copy of this object.- Specified by:
copy
in interfaceValueType
- Specified by:
copy
in classAbstractField<AprationalField,
Aprational> - Returns:
- A copy of this object.
-