public class Maths extends Object
| Modifier and Type | Field and Description |
|---|---|
static double |
WHOLE_NUMBER
Numbers larger than this are whole numbers due to representation error.
|
| Constructor and Description |
|---|
Maths() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(long x,
long y)
Compares two
long values numerically. |
static long |
hash(CharSequence cs) |
static int |
hash(int n) |
static int |
hash(long n) |
static int |
intLog2(long num) |
static int |
nextPower2(int n,
int min) |
static long |
nextPower2(long n,
long min) |
static long |
power10(int n) |
static double |
round2(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round4(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round6(double d)
Performs a round which is accurate to within 1 ulp.
|
static double |
round8(double d)
Performs a round which is accurate to within 1 ulp.
|
public static final double WHOLE_NUMBER
public static double round2(double d)
d - value to roundpublic static double round4(double d)
d - value to roundpublic static double round6(double d)
d - value to roundpublic static double round8(double d)
d - value to roundpublic static long power10(int n)
public static int nextPower2(int n,
int min)
public static long nextPower2(long n,
long min)
public static int hash(int n)
public static int hash(long n)
public static long hash(CharSequence cs)
public static int compare(long x,
long y)
long values numerically. The value returned is identical to what would be returned by:
Long.valueOf(x).compareTo(Long.valueOf(y))
x - the first long to comparey - the second long to compare0 if x == y; a value less than 0 if x < y; and a value greater
than 0 if x > ypublic static int intLog2(long num)
Copyright © 2014. All Rights Reserved.