|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--edu.stanford.nlp.math.ScientificNotationDouble
ScientificNotationDouble allows very small and very large numbers to be multiplied without causing a floating point underflow/overflow. has a base (which is a double x s.t. 1<=x<10), and an exponent such that the double value of ScientificNotationDouble is base * 10^exponent note: ScientificNotationDouble does not handle negative numbers. this is to increase the speed.
Constructor Summary | |
ScientificNotationDouble()
creates a new ScientificNotationDouble with value 0 |
|
ScientificNotationDouble(double d)
constructs ScientificNotationDouble from a standard double |
|
ScientificNotationDouble(double b,
int e)
constructs ScientificNotationDouble given a base b and an exponent e |
|
ScientificNotationDouble(int i)
constructs ScientificNotationDouble from a standard int |
|
ScientificNotationDouble(ScientificNotationDouble other)
constructs ScientificNotationDouble from another ScientificNotationDouble |
Method Summary | |
ScientificNotationDouble |
add(ScientificNotationDouble addend)
returns the sum of this and addend |
ScientificNotationDouble |
divide(ScientificNotationDouble divisor)
|
double |
doubleValue()
|
void |
ensureProperBase()
ensures that the base of the ScientificNotationDouble is >=1 and <10. |
float |
floatValue()
|
double |
getBase()
|
int |
getExponent()
|
int |
intValue()
|
long |
longValue()
|
ScientificNotationDouble |
multiply(ScientificNotationDouble multiplicand)
returns product of this with multiplicand |
void |
reset()
sets to zero |
ScientificNotationDouble |
scale(int e)
returns a ScientificNotationdouble whose base is scaled so that it = base * 10^e the base may no longer be >=1 and <10 does not change this |
void |
set(double d)
|
void |
set(double b,
int e)
|
void |
set(int i)
|
void |
setBase(double b)
|
void |
setExponent(int e)
|
void |
setSmallToZero(int tolerance)
set numbers which are smaller than 10^tolerance = 0 the tolerance should usually be a large negative number |
String |
toString()
|
Methods inherited from class java.lang.Number |
byteValue, shortValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ScientificNotationDouble()
public ScientificNotationDouble(int i)
public ScientificNotationDouble(double d)
public ScientificNotationDouble(double b, int e)
b
and an exponent e
public ScientificNotationDouble(ScientificNotationDouble other)
Method Detail |
public double getBase()
public int getExponent()
public void setBase(double b)
public void setExponent(int e)
public void set(double b, int e)
public void reset()
public void set(double d)
public void set(int i)
public ScientificNotationDouble scale(int e)
this
public void ensureProperBase()
public ScientificNotationDouble multiply(ScientificNotationDouble multiplicand)
public ScientificNotationDouble divide(ScientificNotationDouble divisor)
public ScientificNotationDouble add(ScientificNotationDouble addend)
public double doubleValue()
doubleValue
in class Number
public float floatValue()
floatValue
in class Number
public int intValue()
intValue
in class Number
public long longValue()
longValue
in class Number
public String toString()
toString
in class Object
public void setSmallToZero(int tolerance)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |