medusa.georgios.enhanced_mcl
Class ExpDouble
- java.lang.Object
-
- medusa.georgios.enhanced_mcl.ExpDouble
-
public class ExpDouble extends java.lang.ObjectExpDouble represents a double-precision number by a mantissa, a decimal exponent and the number of digits in the mantissa, in order to allow formatting of the represented double.
-
-
Constructor Summary
Constructors Constructor and Description ExpDouble(double x, int maxdigits)Creates an ExpDouble from a double, with the specified number of digits.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Stringdebug()static intorderOfMagnitude(double x)booleanround(int ndigits)Round this instance to the number of significant digitsdoubletoDouble()doubletoDoubleUnsigned()java.lang.StringtoExpString()java.lang.StringtoString()
-
-
-
Constructor Detail
-
ExpDouble
public ExpDouble(double x, int maxdigits)Creates an ExpDouble from a double, with the specified number of digits.- Parameters:
x-maxdigits-
-
-
Method Detail
-
round
public boolean round(int ndigits)
Round this instance to the number of significant digits- Parameters:
digits-- Returns:
- whether magnitude and digits had to be changed by rounding values >9.5 to 10
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of this object
-
toExpString
public java.lang.String toExpString()
- Returns:
- a string representation in exponential notation
-
debug
public java.lang.String debug()
- Returns:
- a debug string with the part of this ExpDouble
-
toDoubleUnsigned
public double toDoubleUnsigned()
- Returns:
- double representation of this object according to rounding.
-
toDouble
public double toDouble()
- Returns:
- double representation of this object according to rounding.
-
orderOfMagnitude
public static int orderOfMagnitude(double x)
- Parameters:
x-- Returns:
- order of magnitue of x, i.e., n : x in [ 10^n, 10^(n+1) )
-
-
DMelt 3.0 © DataMelt by jWork.ORG