|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.math.Rounding
The Rounding class provides a type safe enumeration of strategies for handling loss of numeric resolution. Rounding is typically resolved when quantization constraints are applied to a computed result in order to satisfy the requirements of the type to which the result is to be assigned.
The rounding strategies are
The truncate and nearest strategies should be preferred since they correspond to capabilities available on many processors. Other rounding strategies may require costly code on practical hardware.
The active class functionality is provided by the quantize method which is normally invoked from Quantization.quantize.
| Red |
| Red (Ed.Willink) |
| Nested Class Summary | |
static class |
Rounding.General
The general rounding strategy at the top of the rounding lattice |
static class |
Rounding.RoundCeiling
The round towards plus infinity rounding strategy |
static class |
Rounding.RoundDown
The round towards zero rounding strategy |
static class |
Rounding.RoundFloor
The round towards minus infinity (truncate) rounding strategy |
static class |
Rounding.RoundHalfCeiling
The round to nearest and halves towards plus infinity (nearest) rounding strategy |
static class |
Rounding.RoundHalfDown
The round to nearest and halves towards zero rounding strategy |
static class |
Rounding.RoundHalfEven
The round to nearest and halves towards the even value (convergent) rounding strategy |
static class |
Rounding.RoundHalfFloor
The round to nearest and halves towards minus infinity rounding strategy |
static class |
Rounding.RoundHalfUp
The round to nearest and halves away from zero rounding strategy |
static class |
Rounding.RoundUnnecessary
The no rounding necessary rounding strategy |
static class |
Rounding.RoundUp
The round away from zero rounding strategy |
static class |
Rounding.Unknown
The unknown rounding strategy at the bottom of the rounding lattice |
| Field Summary | |
static Rounding.RoundCeiling |
CEILING
|
static Rounding.RoundHalfEven |
CONVERGENT
|
static Rounding.RoundDown |
DOWN
|
static Rounding.RoundFloor |
FLOOR
|
static Rounding.General |
GENERAL
|
static Rounding.RoundHalfCeiling |
HALF_CEILING
|
static Rounding.RoundHalfDown |
HALF_DOWN
|
static Rounding.RoundHalfEven |
HALF_EVEN
|
static Rounding.RoundHalfFloor |
HALF_FLOOR
|
static Rounding.RoundHalfUp |
HALF_UP
|
static Rounding.RoundHalfCeiling |
NEAREST
|
static Rounding.RoundFloor |
TRUNCATE
|
static Rounding.Unknown |
UNKNOWN
|
static Rounding.RoundUnnecessary |
UNNECESSARY
|
static Rounding.RoundUp |
UP
|
| Constructor Summary | |
protected |
Rounding(java.lang.String name)
|
| Method Summary | |
protected abstract boolean |
_roundUp(java.math.BigInteger intPart,
double fracPart)
Return true if intPart should be incremented to represent the rounded value of intPart + fracPart, which is positive. |
java.lang.Object |
clone()
Return this, that is, return the reference to this object. |
boolean |
equals(java.lang.Object object)
Determine if the argument represents the same Rounding as this object. |
static Rounding |
forName(java.lang.String name)
Return an instance of this class with the specified name. |
static Rounding |
getName(java.lang.String name)
Return an instance of this class with the specified name, or null if none exists. |
int |
hashCode()
Return a hash code value for this object. |
java.math.BigInteger |
quantize(java.math.BigInteger intPart,
double fracPart)
Return the value of intPart after adjustment for loss of fracPart. |
java.lang.String |
toString()
Return the string representation of this rounding. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Rounding.General GENERAL
public static final Rounding.RoundCeiling CEILING
public static final Rounding.RoundDown DOWN
public static final Rounding.RoundFloor FLOOR
public static final Rounding.RoundFloor TRUNCATE
public static final Rounding.RoundHalfCeiling HALF_CEILING
public static final Rounding.RoundHalfCeiling NEAREST
public static final Rounding.RoundHalfDown HALF_DOWN
public static final Rounding.RoundHalfEven HALF_EVEN
public static final Rounding.RoundHalfEven CONVERGENT
public static final Rounding.RoundHalfFloor HALF_FLOOR
public static final Rounding.RoundHalfUp HALF_UP
public static final Rounding.RoundUnnecessary UNNECESSARY
public static final Rounding.RoundUp UP
public static final Rounding.Unknown UNKNOWN
| Constructor Detail |
protected Rounding(java.lang.String name)
| Method Detail |
public java.lang.Object clone()
public boolean equals(java.lang.Object object)
object - Another object.
public static Rounding forName(java.lang.String name)
public static Rounding getName(java.lang.String name)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - If the string does not
match one of the known strategies.public int hashCode()
public java.math.BigInteger quantize(java.math.BigInteger intPart,
double fracPart)
public java.lang.String toString()
protected abstract boolean _roundUp(java.math.BigInteger intPart,
double fracPart)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||