Package gnu.math
Class Numeric
java.lang.Object
java.lang.Number
gnu.math.Numeric
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Quantity
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
Rounding mode to always produce a non-negative remainder.static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Numeric
abs()
final Numeric
abstract Numeric
Return this + k * obj.addReversed
(Numeric x, int k) Calculatex+k&this
.static Numeric
asNumericOrNull
(Object value) int
Return an integer for which ofthis
orobj
is larger.int
abstract Numeric
div_inv()
Return the multiplicative inverse.boolean
float
boolean
boolean
int
intValue()
abstract boolean
isExact()
abstract boolean
isZero()
long
abstract Numeric
Return the multiplicative identity.abstract Numeric
neg()
Return this raised to an integer power.final Numeric
toExact()
toString()
abstract String
toString
(int radix) Methods inherited from class java.lang.Number
byteValue, doubleValue, shortValue
-
Field Details
-
FLOOR
public static final int FLOOR- See Also:
-
CEILING
public static final int CEILING- See Also:
-
TRUNCATE
public static final int TRUNCATE- See Also:
-
ROUND
public static final int ROUND- See Also:
-
NONNEG_MOD
public static final int NONNEG_MODRounding 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:
-
-
Constructor Details
-
Numeric
public Numeric()
-
-
Method Details
-
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
intValue
public int intValue() -
longValue
public long longValue() -
add
Return this + k * obj. -
add
-
sub
-
mul
-
div
-
abs
-
neg
-
toString
-
toString
-
asNumericOrNull
-
isExact
public abstract boolean isExact() -
toExact
-
toInexact
-
isZero
public abstract boolean isZero() -
compare
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
-
equals
-
grt
-
geq
-
addReversed
Calculatex+k&this
. -
mulReversed
-
divReversed
-
div_inv
Return the multiplicative inverse. -
mul_ident
Return the multiplicative identity. -
power
Return this raised to an integer power. Implemented by repeated squaring and multiplication. Ify < 0
, returns div_inv of the result.
-