gnu.math

Class DFloNum

Implemented Interfaces:
Comparable, Externalizable

public class DFloNum
extends RealNum
implements Externalizable

Field Summary

Fields inherited from class gnu.math.Numeric

CEILING, FLOOR, ROUND, TRUNCATE

Constructor Summary

DFloNum()
DFloNum(String s)
DFloNum(double value)

Method Summary

Numeric
add(Object y, int k)
Return this + k * obj.
Numeric
addReversed(Numeric x, int k)
Calculate x+k&this.
int
compare(Object obj)
Return an integer for which of {# code this} or {#code obj} is larger.
static int
compare(double x, double y)
static int
compare(IntNum x_num, IntNum x_den, double y)
Compare (x_num/x_den) with toExact(y).
int
compareReversed(Numeric x)
Numeric
div(Object y)
Numeric
divReversed(Numeric x)
double
doubleValue()
The value of the real component, as a double.
boolean
equals(Object obj)
int
hashCode()
boolean
isExact()
boolean
isNegative()
boolean
isZero()
long
longValue()
static DFloNum
make(double value)
Numeric
mul(Object y)
Numeric
mulReversed(Numeric x)
Numeric
neg()
static DFloNum
one()
Numeric
power(IntNum y)
Return this raised to an integer power.
void
readExternal(ObjectInput in)
int
sign()
Return 1 if >0; 0 if ==0; -1 if <0; -2 if NaN.
static RatNum
toExact(double value)
Converts to the closest exact rational value.
String
toString()
String
toString(int radix)
void
writeExternal(ObjectOutput out)

Methods inherited from class gnu.math.RealNum

abs, add, add, asBigDecimal, compareTo, div, divide, exp, im, isNegative, isZero, log, max, min, mul, re, rneg, sign, sin, sqrt, times, toExact, toExactInt, toExactInt, toExactInt, toInt, toInt, toScaledInt, toScaledInt, toScaledInt, toStringDecimal, toStringScientific, toStringScientific, toStringScientific, toStringScientific

Methods inherited from class gnu.math.Complex

abs, add, add, addReversed, angle, compare, compare, div, divReversed, divide, doubleImagValue, doubleRealValue, doubleValue, equals, equals, exp, imMinusOne, imOne, isExact, isZero, log, longValue, make, make, mul, mulReversed, neg, neg, number, polar, polar, power, sqrt, times, toString

Methods inherited from class gnu.math.Quantity

abs, add, add, addReversed, compare, compare, compareReversed, dimensions, div, divReversed, divide, doubleImagValue, doubleValue, im, imValue, make, make, make, mul, mulReversed, neg, number, re, reValue, times, toString, unit

Methods inherited from class gnu.math.Numeric

abs, add, add, addReversed, compare, compareReversed, div, divReversed, div_inv, equals, floatValue, geq, grt, intValue, isExact, isZero, longValue, mul, mulReversed, mul_ident, neg, power, sub, toString, toString

Constructor Details

DFloNum

public DFloNum()

DFloNum

public DFloNum(String s)
            throws NumberFormatException

DFloNum

public DFloNum(double value)

Method Details

add

public Numeric add(Object y,
                   int k)
Return this + k * obj.
Overrides:
add in interface RealNum

addReversed

public Numeric addReversed(Numeric x,
                           int k)
Calculate x+k&this.
Overrides:
addReversed in interface Complex

compare

public int compare(Object obj)
Return an integer for which of {# code this} or {#code obj} is larger. Return 1 if this>obj; 0 if this==obj; -1 if this; -2 if this!=obj otherwise (for example if either is NaN); -3 if not comparable (incompatible types).
Overrides:
compare in interface Complex

compare

public static int compare(double x,
                          double y)

compare

public static int compare(IntNum x_num,
                          IntNum x_den,
                          double y)
Compare (x_num/x_den) with toExact(y).


div

public Numeric div(Object y)
Overrides:
div in interface RealNum

divReversed

public Numeric divReversed(Numeric x)
Overrides:
divReversed in interface Complex



hashCode

public int hashCode()





make

public static DFloNum make(double value)

mul

public Numeric mul(Object y)
Overrides:
mul in interface RealNum

mulReversed

public Numeric mulReversed(Numeric x)
Overrides:
mulReversed in interface Complex

neg

public Numeric neg()
Overrides:
neg in interface Complex


power

public Numeric power(IntNum y)
Return this raised to an integer power. Implemented by repeated squaring and multiplication. If y <320, returns div_inv of the result.
Overrides:
power in interface Numeric

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException


toExact

public static RatNum toExact(double value)
Converts to the closest exact rational value.



writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException