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 RealNum
abstract Numeric
Return this + k * obj.final RealNum
angle()
static RealNum
asRealNumOrNull
(Object value) int
Check if value is finite, infinite, or NaN.int
Implements the Comparable interface.final Quaternion
final RealNum
cos()
abstract Numeric
static RealNum
exp()
final RealNum
im()
The value of the imaginary component, as a RealNum.abstract boolean
static boolean
boolean
isZero()
log()
abstract Numeric
final RealNum
re()
The value of the real component, as a RealNum.rneg()
abstract int
sign()
Return 1 if>0
; 0 if==0
; -1 if<0
; -2 ifNaN
.final RealNum
sin()
final Complex
sqrt()
final RealNum
tan()
static RealNum
toExact()
Convert to an exact number.static IntNum
toExactInt
(double value) Converts an integral double (such as a toInt result) to an IntNum.static IntNum
toExactInt
(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 double
toInt
(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 IntNum
toScaledInt
(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 IntNum
toScaledInt
(RatNum r, int k) Convert rational to (rounded) integer, after multiplying by 10**k.static String
toStringDecimal
(String dstr) static String
toStringScientific
(double d) static String
toStringScientific
(float d) static String
toStringScientific
(String dstr) Convert result of Double.toString or Float.toString to scientific notation.static int
toStringScientific
(String dstr, StringBuffer sbuf) final Quaternion
final Quaternion
final Quaternion
Methods 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, toString
Methods 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, times
Methods inherited from class gnu.math.Quantity
add, compare, compareReversed, dimensions, divide, imValue, jmValue, kmValue, make, make, make, reValue, times, unit
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, floatValue, geq, grt, intValue, mul_ident, power, sub, toString
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
RealNum
public RealNum()
-
-
Method Details
-
re
Description copied from class:Quantity
The 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:Quantity
The 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:
vectorPart
in classComplex
-
unitVector
- Overrides:
unitVector
in classComplex
-
unitQuaternion
- Overrides:
unitQuaternion
in classComplex
-
conjugate
-
isReal
-
asRealNumOrNull
-
isNegative
public abstract boolean isNegative() -
classifyFinite
public int classifyFinite()Description copied from class:Complex
Check if value is finite, infinite, or NaN.- Overrides:
classifyFinite
in 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:Numeric
Return 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:
compareTo
in interfaceComparable
-
asBigDecimal
-
toStringScientific
-
toStringScientific
-
toStringScientific
Convert result of Double.toString or Float.toString to scientific notation. Does not validate the input. -
toStringScientific
-
toStringDecimal
-