|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgenerator.engin.utils.AdjustPrecision
public class AdjustPrecision
AdjustPrecision
This class is used to round real numbers at the specified maximum number of decimals. A number can be eighter rounded up or down depending of the situation. All methods are static, hence the class cannot be instanced.Copyright(c) 2005 Université Laval, LSFM research group.
Constructor Summary | |
---|---|
AdjustPrecision()
|
Method Summary | |
---|---|
static int |
getPrecision()
Returns the current maximum number of decimals |
static void |
mustContain(int maxDecimalPart)
Automatically increase the current maximum number of decimals if the specified maximum decimal part value cannot be represented using the current maximum number of decimals. |
static double |
roundUp(double number)
This method round a real number to the nearest superior decimal at the specified maximum number of decimals. |
static void |
setPrecision(int precision)
Sets the maximum number of decimals allowed in a real number. |
static double |
truncate(double number)
This method truncates a real number at the specified maximum number of decimals. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AdjustPrecision()
Method Detail |
---|
public static double truncate(double number)
number
- the number to truncate
public static double roundUp(double number)
number
- the number to round
public static void setPrecision(int precision) throws ParameterException
precision
- the number of decimals to keep
ParameterException
- should the precision specified be invalidpublic static int getPrecision()
public static void mustContain(int maxDecimalPart)
maxDecimalPart
- the largest decimal part to be represented
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |