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 1 if this>obj; 0 if this==obj; -1 if this
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, 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

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 1 if this>obj; 0 if this==obj; -1 if this
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).

compareReversed

public int compareReversed(Numeric x)
Overrides:
compareReversed in interface Quantity

div

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

divReversed

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

doubleValue

public final double doubleValue()
The value of the real component, as a double. This is relative to the unit().dims - i.e. unit()/doubleValue() is factored in.
Overrides:
doubleValue in interface Complex

equals

public boolean equals(Object obj)
Overrides:
equals in interface Complex

hashCode

public int hashCode()

isExact

public boolean isExact()
Overrides:
isExact in interface Complex

isNegative

public boolean isNegative()
Overrides:
isNegative in interface RealNum

isZero

public boolean isZero()
Overrides:
isZero in interface RealNum

longValue

public long longValue()
Overrides:
longValue in interface Complex

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

one

public static final DFloNum one()

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

sign

public int sign()
Return 1 if >0; 0 if ==0; -1 if <0; -2 if NaN.
Overrides:
sign in interface RealNum

toExact

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

toString

public String toString()
Overrides:
toString in interface Numeric

toString

public String toString(int radix)
Overrides:
toString in interface Complex

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException