Package de.tilman_neumann.jml.precision
Class Scale
- java.lang.Object
-
- de.tilman_neumann.jml.precision.Scale
-
- All Implemented Interfaces:
Comparable<Scale>
public class Scale extends Object implements Comparable<Scale>
Immutable class for precision statements in after-floating point decimal digits.- Author:
- Tilman Neumann
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Scale
add(int n)
BigDecimal
applyTo(BigDecimal x)
int
compareTo(Scale other)
int
digits()
boolean
equals(Object o)
BigDecimal
getErrorBound()
The error a computation with this scale should not exceed.int
hashCode()
Scale
multiply(int multiplier)
static Scale
of(double x)
static Scale
of(float x)
static Scale
of(BigDecimal x)
String
toString()
static Scale
valueOf(int digits)
-
-
-
Method Detail
-
valueOf
public static Scale valueOf(int digits)
-
of
public static Scale of(float x)
-
of
public static Scale of(double x)
-
of
public static Scale of(BigDecimal x)
-
add
public Scale add(int n)
-
multiply
public Scale multiply(int multiplier)
-
applyTo
public BigDecimal applyTo(BigDecimal x)
-
getErrorBound
public BigDecimal getErrorBound()
The error a computation with this scale should not exceed. This is just half of an ulp for values with this scale, thus computation results should be correct to this scale after rounding.- Returns:
- maximum allowed error
-
digits
public int digits()
-
compareTo
public int compareTo(Scale other)
- Specified by:
compareTo
in interfaceComparable<Scale>
-
-