Package gnu.math
Class RealNum
java.lang.Object
java.lang.Number
gnu.math.Numeric
gnu.math.Quantity
gnu.math.Quaternion
gnu.math.Complex
gnu.math.RealNum
- All Implemented Interfaces:
Serializable,Comparable
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()static RealNumabstract NumericReturn this + k * obj.final RealNumangle()static RealNumasRealNumOrNull(Object value) intCheck if value is finite, infinite, or NaN.intImplements the Comparable interface.final Quaternionfinal RealNumcos()abstract Numericstatic RealNumexp()final RealNumim()The value of the imaginary component, as a RealNum.abstract booleanstatic booleanbooleanisZero()log()abstract Numericfinal RealNumre()The value of the real component, as a RealNum.rneg()abstract intsign()Return 1 if>0; 0 if==0; -1 if<0; -2 ifNaN.final RealNumsin()final Complexsqrt()final RealNumtan()static RealNumtoExact()Convert to an exact number.static IntNumtoExactInt(double value) Converts an integral double (such as a toInt result) to an IntNum.static IntNumtoExactInt(double value, int rounding_mode) Converts real to an exact integer, with specified rounding mode.toExactInt(int rounding_mode) Converts to an exact integer, with specified rounding mode.static doubletoInt(double d, int rounding_mode) Converts a real to an integer, according to a specified rounding mode.toInt(int rounding_mode) Converts a real to an integer, according to a specified rounding mode.static IntNumtoScaledInt(double f, int k) Convert double to (rounded) integer, after multiplying by 10**k.toScaledInt(int k) Convert this to (rounded) integer, after multiplying by 10**k.static IntNumtoScaledInt(RatNum r, int k) Convert rational to (rounded) integer, after multiplying by 10**k.static StringtoStringDecimal(String dstr) static StringtoStringScientific(double d) static StringtoStringScientific(float d) static StringtoStringScientific(String dstr) Convert result of Double.toString or Float.toString to scientific notation.static inttoStringScientific(String dstr, StringBuffer sbuf) final Quaternionfinal Quaternionfinal QuaternionMethods inherited from class gnu.math.Complex
add, addReversed, colatitude, compare, compare, complexPart, divide, divReversed, equals, equals, imMinusOne, imOne, isExact, jm, km, longitude, make, make, mulReversed, neg, neg, polar, polar, power, times, toStringMethods inherited from class gnu.math.Quaternion
add, compare, divide, doubleImagValue, doubleJmagValue, doubleKmagValue, doubleRealValue, doubleValue, equals, jmMinusOne, jmOne, kmMinusOne, kmOne, longValue, make, make, neg, number, polar, polar, power, timesMethods inherited from class gnu.math.Quantity
add, compare, compareReversed, dimensions, divide, imValue, jmValue, kmValue, make, make, make, reValue, times, unitMethods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, floatValue, geq, grt, intValue, mul_ident, power, sub, toStringMethods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
RealNum
public RealNum()
-
-
Method Details
-
re
Description copied from class:QuantityThe value of the real component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true real component. -
im
Description copied from class:QuantityThe value of the imaginary component, as a RealNum. The unit() is not factored in, so you actually need to multiply by unit() to get the true imaginary component. -
angle
-
vectorPart
- Overrides:
vectorPartin classComplex
-
unitVector
- Overrides:
unitVectorin classComplex
-
unitQuaternion
- Overrides:
unitQuaternionin classComplex
-
conjugate
-
isReal
-
asRealNumOrNull
-
isNegative
public abstract boolean isNegative() -
classifyFinite
public int classifyFinite()Description copied from class:ComplexCheck if value is finite, infinite, or NaN.- Overrides:
classifyFinitein classComplex- Returns:
- 1 if finite; 0 if infinite; -1 if NaN.
-
sign
public abstract int sign()Return 1 if>0; 0 if==0; -1 if<0; -2 ifNaN. -
max
-
min
-
add
-
times
-
divide
-
add
Description copied from class:NumericReturn this + k * obj. -
mul
-
div
-
abs
-
rneg
-
isZero
public boolean isZero() -
toExact
Convert to an exact number. Implements the Schemeinexact->exact(for real numbers). -
toInexact
-
toInt
public static double toInt(double d, int rounding_mode) Converts a real to an integer, according to a specified rounding mode. Note an inexact argument gives an inexact result, following Scheme. See also RatNum.toExactInt. -
toInt
Converts a real to an integer, according to a specified rounding mode. Note an inexact argument gives an inexact result, following Scheme. See also toExactInt. -
toExactInt
Converts to an exact integer, with specified rounding mode. -
toExactInt
Converts real to an exact integer, with specified rounding mode. -
toExactInt
Converts an integral double (such as a toInt result) to an IntNum. -
exp
-
log
-
sin
-
cos
-
tan
-
sqrt
-
toScaledInt
Convert double to (rounded) integer, after multiplying by 10**k. -
toScaledInt
Convert rational to (rounded) integer, after multiplying by 10**k. -
toScaledInt
Convert this to (rounded) integer, after multiplying by 10**k. -
compareTo
Implements the Comparable interface. This ordering isn't fully consistent with equals, since say it returns 0 when comparing 1.5 and 3/2, though they are not equals.- Specified by:
compareToin interfaceComparable
-
asBigDecimal
-
toStringScientific
-
toStringScientific
-
toStringScientific
Convert result of Double.toString or Float.toString to scientific notation. Does not validate the input. -
toStringScientific
-
toStringDecimal
-