public final class Scalars
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_EPSILON
The default epsilon for checking for zero.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
isZero(double val)
Check whether a value is zero, using a default epsilon.
|
static boolean |
isZero(double val,
double epsilon)
Check whether a value is zero, using a configurable epsilon.
|
static double |
log2(double x) |
public static final double DEFAULT_EPSILON
The default epsilon for checking for zero. If the Java system property lenskit.zero.epsilon
is set, the value of that is used; otherwise, Double.MIN_NORMAL
.
public static boolean isZero(double val)
Check whether a value is zero, using a default epsilon.
val
- The value.true
if the value is within an epsilon of zero.public static boolean isZero(double val, double epsilon)
Check whether a value is zero, using a configurable epsilon.
val
- The value.epsilon
- The tolerance.true
if absolute value of val
is less than epsilon
.public static double log2(double x)