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 intCEILINGstatic intFLOORstatic intNONNEG_MODRounding mode to always produce a non-negative remainder.static intROUNDstatic intTRUNCATE
-
Constructor Summary
Constructors Constructor Description Numeric()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Numericabs()Numericadd(Object obj)abstract Numericadd(Object obj, int k)Return this + k * obj.NumericaddReversed(Numeric x, int k)Calculatex+k&this.static NumericasNumericOrNull(Object value)intcompare(Object obj)Return an integer for which ofthisorobjis larger.intcompareReversed(Numeric x)abstract Numericdiv(Object obj)Numericdiv_inv()Return the multiplicative inverse.NumericdivReversed(Numeric x)booleanequals(Object obj)floatfloatValue()booleangeq(Object x)booleangrt(Object x)intintValue()abstract booleanisExact()abstract booleanisZero()longlongValue()abstract Numericmul(Object obj)Numericmul_ident()Return the multiplicative identity.NumericmulReversed(Numeric x)abstract Numericneg()Numericpower(IntNum y)Return this raised to an integer power.Numericsub(Object obj)NumerictoExact()NumerictoInexact()StringtoString()abstract StringtoString(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:
floatValuein 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 ofthisorobjis larger. Return 1 ifthis>obj; 0 ifthis==obj; -1 ifthis<obj; -2 ifthis!=objotherwise (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.
-
-