gnu.math
Class RealNum
public abstract
class
RealNum
extends Complex
implements Comparable
Method Summary |
Numeric | abs() |
static RealNum | add(RealNum x, RealNum y, int k) |
abstract Numeric | add(Object obj, int k) |
BigDecimal | asBigDecimal() |
int | compareTo(Object o) Implements the Comparable interface.
|
abstract Numeric | div(Object obj) |
static RealNum | divide(RealNum x, RealNum y) |
Complex | exp() |
RealNum | im() |
abstract boolean | isNegative() |
boolean | isZero() |
Complex | log() |
RealNum | max(RealNum x) |
RealNum | min(RealNum x) |
abstract Numeric | mul(Object obj) |
RealNum | re() |
RealNum | rneg() |
abstract int | sign() Return 1 if >0; 0 if ==0; -1 if <0; -2 if NaN. |
Complex | sin() |
Complex | sqrt() |
static RealNum | times(RealNum x, RealNum y) |
RatNum | toExact() Convert to an exact number.
|
IntNum | toExactInt(int rounding_mode) Converts to an exact integer, with specified rounding mode. |
static IntNum | toExactInt(double value, int rounding_mode) Converts real to an exact integer, with specified rounding mode. |
static IntNum | toExactInt(double value) Converts an integral double (such as a toInt result) to an IntNum. |
static double | toInt(double d, int rounding_mode) Converts a real to an integer, according to a specified rounding mode.
|
RealNum | 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. |
static IntNum | toScaledInt(RatNum r, int k) Convert rational to (rounded) integer, after multiplying by 10**k. |
IntNum | toScaledInt(int k) Convert this to (rounded) integer, after multiplying by 10**k. |
static String | toStringDecimal(String dstr) |
static String | toStringScientific(float d) |
static String | toStringScientific(double d) |
static String | toStringScientific(String dstr) Convert result of Double.toString or Float.toString to
scientific notation.
|
static int | toStringScientific(String dstr, StringBuffer sbuf) |
public abstract
Numeric add(Object obj, int k)
public BigDecimal asBigDecimal()
public int compareTo(Object o)
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.
public abstract
Numeric div(Object obj)
public abstract boolean isNegative()
public boolean isZero()
public abstract
Numeric mul(Object obj)
public abstract int sign()
Return 1 if >0; 0 if ==0; -1 if <0; -2 if NaN.
Convert to an exact number.
Implements the Scheme inexact->exact (for real numbers).
public
IntNum toExactInt(int rounding_mode)
Converts to an exact integer, with specified rounding mode.
public static
IntNum toExactInt(double value, int rounding_mode)
Converts real to an exact integer, with specified rounding mode.
public static
IntNum toExactInt(double value)
Converts an integral double (such as a toInt result) to an IntNum.
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.
public
RealNum toInt(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 toExactInt.
public static
IntNum toScaledInt(double f, int k)
Convert double to (rounded) integer, after multiplying by 10**k.
Convert rational to (rounded) integer, after multiplying by 10**k.
public
IntNum toScaledInt(int k)
Convert this to (rounded) integer, after multiplying by 10**k.
public static String toStringDecimal(String dstr)
public static String toStringScientific(float d)
public static String toStringScientific(double d)
public static String toStringScientific(String dstr)
Convert result of Double.toString or Float.toString to
scientific notation.
Does not validate the input.
public static int toStringScientific(String dstr, StringBuffer sbuf)