gnu.math
Class DFloNum

java.lang.Object
  extended by java.lang.Number
      extended by gnu.math.Numeric
          extended by gnu.math.Quantity
              extended by gnu.math.Complex
                  extended by gnu.math.RealNum
                      extended by gnu.math.DFloNum
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Comparable

public class DFloNum
extends RealNum
implements java.io.Externalizable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.math.Numeric
CEILING, FLOOR, ROUND, TRUNCATE
 
Constructor Summary
DFloNum()
           
DFloNum(double value)
           
DFloNum(java.lang.String s)
           
 
Method Summary
 Numeric add(java.lang.Object y, int k)
          Return this + k * obj.
 Numeric addReversed(Numeric x, int k)
          Calculate x+k&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 compare(java.lang.Object obj)
          Return an integer for which of {# code this} or {#code obj} is larger.
 int compareReversed(Numeric x)
           
 Numeric div(java.lang.Object y)
           
 Numeric divReversed(Numeric x)
           
 double doubleValue()
          The value of the real component, as a double.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isExact()
           
 boolean isNegative()
           
 boolean isZero()
           
 long longValue()
           
static DFloNum make(double value)
           
 Numeric mul(java.lang.Object y)
           
 Numeric mulReversed(Numeric x)
           
 Numeric neg()
           
static DFloNum one()
           
 Numeric power(IntNum y)
          Return this raised to an integer power.
 void readExternal(java.io.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.
 java.lang.String toString()
           
 java.lang.String toString(int radix)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class gnu.math.RealNum
abs, add, asBigDecimal, compareTo, divide, exp, im, log, max, min, re, rneg, sin, sqrt, times, toExact, toExactInt, toExactInt, toExactInt, toInt, toInt, toScaledInt, toScaledInt, toScaledInt, toStringDecimal, toStringScientific, toStringScientific, toStringScientific, toStringScientific
 
Methods inherited from class gnu.math.Complex
add, angle, compare, divide, doubleImagValue, doubleRealValue, equals, imMinusOne, imOne, make, make, neg, number, polar, polar, power, times
 
Methods inherited from class gnu.math.Quantity
add, compare, dimensions, divide, imValue, make, make, make, reValue, times, unit
 
Methods inherited from class gnu.math.Numeric
add, div_inv, floatValue, geq, grt, intValue, mul_ident, sub
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DFloNum

public DFloNum()

DFloNum

public DFloNum(double value)

DFloNum

public DFloNum(java.lang.String s)
        throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException
Method Detail

make

public static DFloNum make(double value)

doubleValue

public final double doubleValue()
Description copied from class: Quantity
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 class Complex

longValue

public long longValue()
Overrides:
longValue in class Complex

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Complex

add

public Numeric add(java.lang.Object y,
                   int k)
Description copied from class: Numeric
Return this + k * obj.

Specified by:
add in class RealNum

addReversed

public Numeric addReversed(Numeric x,
                           int k)
Description copied from class: Numeric
Calculate x+k&this.

Overrides:
addReversed in class Complex

mul

public Numeric mul(java.lang.Object y)
Specified by:
mul in class RealNum

mulReversed

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

one

public static final DFloNum one()

div

public Numeric div(java.lang.Object y)
Specified by:
div in class RealNum

divReversed

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

power

public Numeric power(IntNum y)
Description copied from class: Numeric
Return this raised to an integer power. Implemented by repeated squaring and multiplication. If y < 0, returns div_inv of the result.

Overrides:
power in class Numeric

isNegative

public boolean isNegative()
Specified by:
isNegative in class RealNum

neg

public Numeric neg()
Overrides:
neg in class Complex

sign

public int sign()
Description copied from class: RealNum
Return 1 if >0; 0 if ==0; -1 if <0; -2 if NaN.

Specified by:
sign in class RealNum

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).


compare

public int compare(java.lang.Object obj)
Description copied from class: Numeric
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<obj; -2 if this!=obj otherwise (for example if either is NaN); -3 if not comparable (incompatible types).

Overrides:
compare in class Complex

compareReversed

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

isExact

public boolean isExact()
Overrides:
isExact in class Complex

isZero

public boolean isZero()
Overrides:
isZero in class RealNum

toExact

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


toString

public java.lang.String toString()
Overrides:
toString in class Numeric

toString

public java.lang.String toString(int radix)
Overrides:
toString in class Complex

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException