gnu.math
Class Numeric

java.lang.Object
  extended by java.lang.Number
      extended by gnu.math.Numeric
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Quantity

public abstract class Numeric
extends java.lang.Number

See Also:
Serialized Form

Field Summary
static int CEILING
           
static int FLOOR
           
static int ROUND
           
static int TRUNCATE
           
 
Constructor Summary
Numeric()
           
 
Method Summary
abstract  Numeric abs()
           
 Numeric add(java.lang.Object obj)
           
abstract  Numeric add(java.lang.Object obj, int k)
          Return this + k * obj.
 Numeric addReversed(Numeric x, int k)
          Calculate x+k&this.
 int compare(java.lang.Object obj)
          Return 1 if this>obj; 0 if this==obj; -1 if this
 int compareReversed(Numeric x)
           
 Numeric div_inv()
          Return the multiplicative inverse.
abstract  Numeric div(java.lang.Object obj)
           
 Numeric divReversed(Numeric x)
           
 boolean equals(java.lang.Object obj)
           
 float floatValue()
           
 boolean geq(java.lang.Object x)
           
 boolean grt(java.lang.Object x)
           
 int intValue()
           
abstract  boolean isExact()
           
abstract  boolean isZero()
           
 long longValue()
           
 Numeric mul_ident()
          Return the multiplicative identity.
abstract  Numeric mul(java.lang.Object obj)
           
 Numeric mulReversed(Numeric x)
           
abstract  Numeric neg()
           
 Numeric power(IntNum y)
          Return this raised to an integer power.
 Numeric sub(java.lang.Object obj)
           
 java.lang.String toString()
           
abstract  java.lang.String toString(int radix)
           
 
Methods inherited from class java.lang.Number
byteValue, doubleValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FLOOR

public static final int FLOOR
See Also:
Constant Field Values

CEILING

public static final int CEILING
See Also:
Constant Field Values

TRUNCATE

public static final int TRUNCATE
See Also:
Constant Field Values

ROUND

public static final int ROUND
See Also:
Constant Field Values
Constructor Detail

Numeric

public Numeric()
Method Detail

floatValue

public float floatValue()
Specified by:
floatValue in class java.lang.Number

intValue

public int intValue()
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Specified by:
longValue in class java.lang.Number

add

public abstract Numeric add(java.lang.Object obj,
                            int k)
Return this + k * obj.


add

public final Numeric add(java.lang.Object obj)

sub

public final Numeric sub(java.lang.Object obj)

mul

public abstract Numeric mul(java.lang.Object obj)

div

public abstract Numeric div(java.lang.Object obj)

abs

public abstract Numeric abs()

neg

public abstract Numeric neg()

toString

public abstract java.lang.String toString(int radix)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isExact

public abstract boolean isExact()

isZero

public abstract boolean isZero()

compare

public int compare(java.lang.Object obj)
Return 1 if this>obj; 0 if this==obj; -1 if this

compareReversed

public int compareReversed(Numeric x)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

grt

public boolean grt(java.lang.Object x)

geq

public boolean geq(java.lang.Object x)

addReversed

public Numeric addReversed(Numeric x,
                           int k)
Calculate x+k&this.


mulReversed

public Numeric mulReversed(Numeric x)

divReversed

public Numeric divReversed(Numeric x)

div_inv

public Numeric div_inv()
Return the multiplicative inverse.


mul_ident

public Numeric mul_ident()
Return the multiplicative identity.


power

public Numeric power(IntNum y)
Return this raised to an integer power. Implemented by repeated squaring and multiplication. If y < 0, returns div_inv of the result.