public final class ValueMath extends Object
| Modifier and Type | Method and Description |
|---|---|
static DoubleValue |
add(double a,
double b)
Addition of two doubles
|
static LongValue |
add(long a,
long b)
Overflow safe addition of two longs
|
static DoubleValue |
multiply(double a,
double b)
Multiplication of two doubles
|
static LongValue |
multiply(long a,
long b)
Overflow safe multiplication of two longs
|
static NumberValue |
overflowSafeAdd(long a,
long b)
Overflow safe addition of two longs
|
static NumberValue |
overflowSafeAdd(NumberValue a,
NumberValue b)
Overflow safe addition of two number values.
|
static NumberValue |
overflowSafeMultiply(long a,
long b)
Overflow safe multiplication of two longs
|
static NumberValue |
overflowSafeSubtract(long a,
long b)
Overflow safe subtraction of two longs
|
static DoubleValue |
subtract(double a,
double b)
Subtraction of two doubles
|
static LongValue |
subtract(long a,
long b)
Overflow safe subtraction of two longs
|
public static LongValue add(long a, long b)
a - left-hand operandb - right-hand operandpublic static NumberValue overflowSafeAdd(NumberValue a, NumberValue b)
Will not overflow but instead widen the type as necessary.
a - left-hand operandb - right-hand operandpublic static NumberValue overflowSafeAdd(long a, long b)
If the result doesn't fit in a long we widen type to use double instead.
a - left-hand operandb - right-hand operandpublic static DoubleValue add(double a, double b)
a - left-hand operandb - right-hand operandpublic static LongValue subtract(long a, long b)
a - left-hand operandb - right-hand operandpublic static NumberValue overflowSafeSubtract(long a, long b)
If the result doesn't fit in a long we widen type to use double instead.
a - left-hand operandb - right-hand operandpublic static DoubleValue subtract(double a, double b)
a - left-hand operandb - right-hand operandpublic static LongValue multiply(long a, long b)
a - left-hand operandb - right-hand operandpublic static NumberValue overflowSafeMultiply(long a, long b)
If the result doesn't fit in a long we widen type to use double instead.
a - left-hand operandb - right-hand operandpublic static DoubleValue multiply(double a, double b)
a - left-hand operandb - right-hand operandCopyright © 2016–2021 MWARE SOLUTIONS. All rights reserved.