CalculationPrecisionStrategy
Inheritance: java.lang.Object
public final class CalculationPrecisionStrategy
Enumerates strategies for handling calculation precision. Because of the precision issue of IEEE 754 Floating-Point Arithmetic, some “seemingly simple” formulas may not be calculated as the expected result. Such as formula “=-0.45+0.43+0.02”, when calculating operands by ‘+’ operator directly, the result is not zero. For such kind of precision issue, some special strategies may give the expected result.
Fields
Field | Description |
---|---|
DECIMAL | Uses decimal as operands when possible. |
NONE | No strategy applied on calculation. |
ROUND | Rounds the calculation result according with significant digits. |
Methods
Method | Description |
---|---|
equals(Object arg0) | |
getClass() | |
hashCode() | |
notify() | |
notifyAll() | |
toString() | |
wait() | |
wait(long arg0) | |
wait(long arg0, int arg1) |
DECIMAL
public static final int DECIMAL
Uses decimal as operands when possible. Most inefficient for performance.
NONE
public static final int NONE
No strategy applied on calculation. When calculating just use the original double value as operand and return the result directly. Most efficient for performance and applicable for most cases.
ROUND
public static final int ROUND
Rounds the calculation result according with significant digits.
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | java.lang.Object |
Returns: boolean
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
hashCode()
public native int hashCode()
Returns: int
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
toString()
public String toString()
Returns: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
Parameter | Type | Description |
---|---|---|
arg0 | long | |
arg1 | int |