Package gnu.math
Class Numeric
- java.lang.Object
-
- java.lang.Number
-
- gnu.math.Numeric
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Quantity
public abstract class Numeric extends Number
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
CEILING
static int
FLOOR
static int
NONNEG_MOD
Rounding mode to always produce a non-negative remainder.static int
ROUND
static int
TRUNCATE
-
Constructor Summary
Constructors Constructor Description Numeric()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Numeric
abs()
Numeric
add(Object obj)
abstract Numeric
add(Object obj, int k)
Return this + k * obj.Numeric
addReversed(Numeric x, int k)
Calculatex+k&this
.static Numeric
asNumericOrNull(Object value)
int
compare(Object obj)
Return an integer for which ofthis
orobj
is larger.int
compareReversed(Numeric x)
abstract Numeric
div(Object obj)
Numeric
div_inv()
Return the multiplicative inverse.Numeric
divReversed(Numeric x)
boolean
equals(Object obj)
float
floatValue()
boolean
geq(Object x)
boolean
grt(Object x)
int
intValue()
abstract boolean
isExact()
abstract boolean
isZero()
long
longValue()
abstract Numeric
mul(Object obj)
Numeric
mul_ident()
Return the multiplicative identity.Numeric
mulReversed(Numeric x)
abstract Numeric
neg()
Numeric
power(IntNum y)
Return this raised to an integer power.Numeric
sub(Object obj)
Numeric
toExact()
Numeric
toInexact()
String
toString()
abstract String
toString(int radix)
-
Methods inherited from class java.lang.Number
byteValue, doubleValue, shortValue
-
-
-
-
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
-
NONNEG_MOD
public static final int NONNEG_MOD
Rounding mode to always produce a non-negative remainder. Like FLOOR if the divisor is non-negative; CEILING otherwise. Used to implement R6RS's div/mod operators.- See Also:
- Constant Field Values
-
-
Method Detail
-
floatValue
public float floatValue()
- Specified by:
floatValue
in classNumber
-
abs
public abstract Numeric abs()
-
neg
public abstract Numeric neg()
-
toString
public abstract String toString(int radix)
-
isExact
public abstract boolean isExact()
-
toExact
public Numeric toExact()
-
toInexact
public Numeric toInexact()
-
isZero
public abstract boolean isZero()
-
compare
public int compare(Object obj)
Return an integer for which ofthis
orobj
is larger. Return 1 ifthis>obj
; 0 ifthis==obj
; -1 ifthis<obj
; -2 ifthis!=obj
otherwise (for example if either is NaN); -3 if not comparable (incompatible types).
-
compareReversed
public int compareReversed(Numeric x)
-
grt
public boolean grt(Object x)
-
geq
public boolean geq(Object x)
-
div_inv
public Numeric div_inv()
Return the multiplicative inverse.
-
mul_ident
public Numeric mul_ident()
Return the multiplicative identity.
-
-