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 intstatic final intstatic final intRounding mode to always produce a non-negative remainder.static final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Numericabs()final Numericabstract NumericReturn this + k * obj.addReversed(Numeric x, int k) Calculatex+k&this.static NumericasNumericOrNull(Object value) intReturn an integer for which ofthisorobjis larger.intabstract Numericdiv_inv()Return the multiplicative inverse.booleanfloatbooleanbooleanintintValue()abstract booleanisExact()abstract booleanisZero()longabstract NumericReturn the multiplicative identity.abstract Numericneg()Return this raised to an integer power.final NumerictoExact()toString()abstract StringtoString(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:
floatValuein 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 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
-
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.
-