Package org.apfloat.jscience
Class AprationalField
- java.lang.Object
-
- java.lang.Number
-
- org.jscience.mathematics.number.Number<T>
-
- org.apfloat.jscience.AbstractField<AprationalField,Aprational>
-
- org.apfloat.jscience.AprationalField
-
- All Implemented Interfaces:
Serializable
,Comparable<AprationalField>
,javolution.lang.Immutable
,javolution.lang.Realtime
,javolution.lang.ValueType
,javolution.xml.XMLSerializable
,org.jscience.mathematics.structure.Field<AprationalField>
,org.jscience.mathematics.structure.GroupAdditive<AprationalField>
,org.jscience.mathematics.structure.GroupMultiplicative<AprationalField>
,org.jscience.mathematics.structure.Ring<AprationalField>
,org.jscience.mathematics.structure.Structure<AprationalField>
public class AprationalField extends AbstractField<AprationalField,Aprational>
This class represents an arbitrary precision rational number.- Since:
- 1.8.0
- Version:
- 1.8.0
- Author:
- Mikko Tommila
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AprationalField(Aprational value)
Constructs a new rational field object with the specified value.
-
Method Summary
Modifier and Type Method Description AprationalField
copy()
Returns a copy of this object.AprationalField
inverse()
Returns the multiplicative inverse of this object.AprationalField
opposite()
Returns the additive inverse of this object.AprationalField
plus(AprationalField that)
Returns the sum of this object with the one specified.AprationalField
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
-
-
-
-
Constructor Detail
-
AprationalField
public AprationalField(Aprational value)
Constructs a new rational field object with the specified value.- Parameters:
value
- The value.
-
-
Method Detail
-
plus
public AprationalField plus(AprationalField that)
Description copied from class:AbstractField
Returns the sum of this object with the one specified.- Specified by:
plus
in interfaceorg.jscience.mathematics.structure.GroupAdditive<AprationalField>
- Specified by:
plus
in classAbstractField<AprationalField,Aprational>
- Parameters:
that
- The addend.- Returns:
this + that
-
opposite
public AprationalField opposite()
Description copied from class:AbstractField
Returns the additive inverse of this object.- Specified by:
opposite
in interfaceorg.jscience.mathematics.structure.GroupAdditive<AprationalField>
- Specified by:
opposite
in classAbstractField<AprationalField,Aprational>
- Returns:
-this
-
times
public AprationalField times(AprationalField that)
Description copied from class:AbstractField
Returns the product of this object with the one specified.- Specified by:
times
in interfaceorg.jscience.mathematics.structure.GroupMultiplicative<AprationalField>
- Specified by:
times
in interfaceorg.jscience.mathematics.structure.Ring<AprationalField>
- Specified by:
times
in classAbstractField<AprationalField,Aprational>
- Parameters:
that
- The multiplicand.- Returns:
this * that
-
inverse
public AprationalField inverse() throws ArithmeticException
Description copied from class:AbstractField
Returns the multiplicative inverse of this object.- Specified by:
inverse
in interfaceorg.jscience.mathematics.structure.GroupMultiplicative<AprationalField>
- Specified by:
inverse
in classAbstractField<AprationalField,Aprational>
- Returns:
1 / this
- Throws:
ArithmeticException
- If the divisor is zero.
-
copy
public AprationalField copy()
Description copied from class:AbstractField
Returns a copy of this object.- Specified by:
copy
in interfacejavolution.lang.ValueType
- Specified by:
copy
in classAbstractField<AprationalField,Aprational>
- Returns:
- A copy of this object.
-
-