public class StrictMa extends java.lang.Object implements TrueStatic
An analog of standard java.lang.StrictMath
class.
It contains all static methods and constants declared in
java.lang.StrictMath
class and a convenient set of
the following additional methods:
iround(double)
minu(byte, byte)
maxu(byte, byte)
minu(short, short)
maxu(short, short)
minu(int, int)
maxu(int, int)
minu(long, long)
maxu(long, long)
min(byte, byte, byte)
max(byte, byte, byte)
median(byte, byte, byte)
min(short, short, short)
max(short, short, short)
median(short, short, short)
min(int, int, int)
max(int, int, int)
median(int, int, int)
min(long, long, long)
max(long, long, long)
median(long, long, long)
min(float, float, float)
max(float, float, float)
median(float, float, float)
min(double, double, double)
max(double, double, double)
median(double, double, double)
between(char, char, char)
between(byte, byte, byte)
between(short, short, short)
between(int, int, int)
between(long, long, long)
between(float, float, float)
between(float, float, float, float)
between(double, double, double)
between(double, double, double, double)
sqr(int)
}
sqr(long)
sqr(float)
sqr(double)
Be careful: min
and max
methods for float and
double values are not identical to the same methods from standard
java.lang.StrictMath
class.
Modifier and Type | Field and Description |
---|---|
static double |
E
An equivalent of
java.lang.StrictMath.E |
static double |
PI
An equivalent of
java.lang.StrictMath.PI |
Modifier and Type | Method and Description |
---|---|
static double |
abs(double a)
An equivalent of
java.lang.StrictMath.abs method. |
static float |
abs(float a)
An equivalent of
java.lang.StrictMath.abs method. |
static int |
abs(int a)
An equivalent of
java.lang.StrictMath.abs method. |
static long |
abs(long a)
An equivalent of
java.lang.StrictMath.abs method. |
static double |
acos(double a)
An equivalent of
java.lang.StrictMath.acos(a) |
static double |
asin(double a)
An equivalent of
java.lang.StrictMath.asin(a) |
static double |
atan(double a)
An equivalent of
java.lang.StrictMath.atan(a) |
static double |
atan2(double a,
double b)
An equivalent of
java.lang.StrictMath.atan2(a,b) |
static boolean |
between(byte a,
byte b,
byte c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static boolean |
between(char a,
char b,
char c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static boolean |
between(double a,
double b,
double c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static boolean |
between(double a,
double b,
double c,
double epsilon)
An equivalent of
a >= min(b, c) + epsilon && a <= max(b, c) - epsilon . |
static boolean |
between(float a,
float b,
float c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static boolean |
between(float a,
float b,
float c,
float epsilon)
An equivalent of
a >= min(b, c) + epsilon && a <= max(b, c) - epsilon . |
static boolean |
between(int a,
int b,
int c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static boolean |
between(long a,
long b,
long c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static boolean |
between(short a,
short b,
short c)
An equivalent of
a >= min(b, c) && a <= max(b, c) . |
static double |
ceil(double a)
An equivalent of
java.lang.StrictMath.ceil(a) |
static double |
cos(double a)
An equivalent of
java.lang.StrictMath.cos(a) |
static double |
exp(double a)
An equivalent of
java.lang.StrictMath.exp(a) |
static double |
floor(double a)
An equivalent of
java.lang.StrictMath.floor(a) |
static double |
IEEEremainder(double a,
double b)
An equivalent of
java.lang.StrictMath.IEEEremainder(a,b) |
static int |
iround(double a)
An equivalent of
(int)java.lang.StrictMath.round(a) call. |
static double |
log(double a)
An equivalent of
java.lang.StrictMath.log(a) |
static byte |
max(byte a,
byte b)
An equivalent of
a >= b? a: b . |
static byte |
max(byte a,
byte b,
byte c)
Quicker equivalent of
max(a,max(b,c)) . |
static double |
max(double a,
double b)
An equivalent of
a >= b? a: b . |
static double |
max(double a,
double b,
double c)
Quicker equivalent of
max(a,max(b,c)) . |
static float |
max(float a,
float b)
An equivalent of
a >= b? a: b . |
static float |
max(float a,
float b,
float c)
Quicker equivalent of
max(a,max(b,c)) . |
static int |
max(int a,
int b)
An equivalent of
a >= b? a: b . |
static int |
max(int a,
int b,
int c)
Quicker equivalent of
max(a,max(b,c)) . |
static long |
max(long a,
long b)
An equivalent of
a >= b? a: b . |
static long |
max(long a,
long b,
long c)
Quicker equivalent of
max(a,max(b,c)) . |
static short |
max(short a,
short b)
An equivalent of
a >= b? a: b . |
static short |
max(short a,
short b,
short c)
Quicker equivalent of
max(a,max(b,c)) . |
static byte |
maxu(byte a,
byte b)
Returns maximum of two unsigned 8-bit integer values.
|
static int |
maxu(int a,
int b)
Returns maximum of two unsigned 32-bit integer values.
|
static long |
maxu(long a,
long b)
Returns maximum of two unsigned 64-bit integer values.
|
static short |
maxu(short a,
short b)
Returns maximum of two unsigned 16-bit integer values.
|
static byte |
median(byte a,
byte b,
byte c)
Returns the median of 3 numbers: the 2nd number in the increasing order.
|
static double |
median(double a,
double b,
double c)
Returns the median of 3 numbers: the 2nd number in the increasing order.
|
static float |
median(float a,
float b,
float c)
Returns the median of 3 numbers: the 2nd number in the increasing order.
|
static int |
median(int a,
int b,
int c)
Returns the median of 3 numbers: the 2nd number in the increasing order.
|
static long |
median(long a,
long b,
long c)
Returns the median of 3 numbers: the 2nd number in the increasing order.
|
static short |
median(short a,
short b,
short c)
Returns the median of 3 numbers: the 2nd number in the increasing order.
|
static byte |
min(byte a,
byte b)
An equivalent of
a <= b? a: b . |
static byte |
min(byte a,
byte b,
byte c)
Quicker equivalent of
min(a,min(b,c)) . |
static double |
min(double a,
double b)
An equivalent of
a <= b? a: b . |
static double |
min(double a,
double b,
double c)
Quicker equivalent of
min(a,min(b,c)) . |
static float |
min(float a,
float b)
An equivalent of
a <= b? a: b . |
static float |
min(float a,
float b,
float c)
Quicker equivalent of
min(a,min(b,c)) . |
static int |
min(int a,
int b)
An equivalent of
a <= b? a: b . |
static int |
min(int a,
int b,
int c)
Quicker equivalent of
min(a,min(b,c)) . |
static long |
min(long a,
long b)
An equivalent of
a <= b? a: b . |
static long |
min(long a,
long b,
long c)
Quicker equivalent of
min(a,min(b,c)) . |
static short |
min(short a,
short b)
An equivalent of
a <= b? a: b . |
static short |
min(short a,
short b,
short c)
Quicker equivalent of
min(a,min(b,c)) . |
static byte |
minu(byte a,
byte b)
Returns minimum of two unsigned 8-bit integer values.
|
static int |
minu(int a,
int b)
Returns minimum of two unsigned 32-bit integer values.
|
static long |
minu(long a,
long b)
Returns minimum of two unsigned 64-bit integer values.
|
static short |
minu(short a,
short b)
Returns minimum of two unsigned 16-bit integer values.
|
static double |
pow(double a,
double b)
An equivalent of
java.lang.StrictMath.pow(a,b) |
static double |
rint(double a)
An equivalent of
java.lang.StrictMath.rint(a) |
static long |
round(double a)
An equivalent of
java.lang.StrictMath.round(a) call. |
static int |
round(float a)
An equivalent of
java.lang.StrictMath.round(a) call. |
static double |
sin(double a)
An equivalent of
java.lang.StrictMath.sin(a) |
static double |
sqr(double a)
An equivalent of
a * a |
static float |
sqr(float a)
An equivalent of
a * a |
static int |
sqr(int a)
An equivalent of
a * a |
static long |
sqr(long a)
An equivalent of
a * a |
static double |
sqrt(double a)
An equivalent of
java.lang.StrictMath.sqrt(a) |
static double |
tan(double a)
An equivalent of
java.lang.StrictMath.tan(a) |
static double |
toDegrees(double a)
An equivalent of
java.lang.StrictMath.toDegrees(a) |
static double |
toRadians(double a)
An equivalent of
java.lang.StrictMath.toRadians(a) |
public static final double E
java.lang.StrictMath.E
public static final double PI
java.lang.StrictMath.PI
public static int iround(double a)
(int)java.lang.StrictMath.round(a)
call.a
- the argument(int)java.lang.StrictMath.round(a)
callpublic static int round(float a)
java.lang.StrictMath.round(a)
call.a
- the argumentjava.lang.StrictMath.round(a)
callpublic static long round(double a)
java.lang.StrictMath.round(a)
call.a
- the argumentjava.lang.StrictMath.round(a)
callpublic static int abs(int a)
java.lang.StrictMath.abs
method.a
- the argumentpublic static long abs(long a)
java.lang.StrictMath.abs
method.a
- the argumentpublic static double abs(double a)
java.lang.StrictMath.abs
method.a
- the argumentpublic static float abs(float a)
java.lang.StrictMath.abs
method.a
- the argumentpublic static byte minu(byte a, byte b)
(a&0xFF) <= (b&0xFF)? a: b
a
- 1st argumentb
- 2nd argumentpublic static byte maxu(byte a, byte b)
(a&0xFF) >= (b&0xFF)? a: b
a
- 1st argumentb
- 2nd argumentpublic static short minu(short a, short b)
((char)a) <= ((char)b)? a: b
a
- 1st argumentb
- 2nd argumentpublic static short maxu(short a, short b)
((char)a) >= ((char)b)? a: b
a
- 1st argumentb
- 2nd argumentpublic static int minu(int a, int b)
(a^0x80000000) <= (b^0x80000000)? a: b
a
- 1st argumentb
- 2nd argumentpublic static int maxu(int a, int b)
(a^0x80000000) >= (b^0x80000000)? a: b
a
- 1st argumentb
- 2nd argumentpublic static long minu(long a, long b)
(a^0x8000000000000000L) <= (b^0x8000000000000000L)? a: b
a
- 1st argumentb
- 2nd argumentpublic static long maxu(long a, long b)
(a^0x8000000000000000L) >= (b^0x8000000000000000L)? a: b
a
- 1st argumentb
- 2nd argumentpublic static byte min(byte a, byte b)
a <= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static byte max(byte a, byte b)
a >= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static short min(short a, short b)
a <= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static short max(short a, short b)
a >= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static int min(int a, int b)
a <= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static int max(int a, int b)
a >= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static long min(long a, long b)
a <= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static long max(long a, long b)
a >= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static float min(float a, float b)
a <= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static float max(float a, float b)
a >= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static double min(double a, double b)
a <= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static double max(double a, double b)
a >= b? a: b
.a
- 1st argumentb
- 2nd argumentpublic static byte min(byte a, byte b, byte c)
min(a,min(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static byte max(byte a, byte b, byte c)
max(a,max(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static byte median(byte a, byte b, byte c)
a
"cut" by the range
min(b,c)...max(b,c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static short min(short a, short b, short c)
min(a,min(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static short max(short a, short b, short c)
max(a,max(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static short median(short a, short b, short c)
a
"cut" by the range
min(b,c)...max(b,c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static int min(int a, int b, int c)
min(a,min(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static int max(int a, int b, int c)
max(a,max(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static int median(int a, int b, int c)
a
"cut" by the range
min(b,c)...max(b,c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static long min(long a, long b, long c)
min(a,min(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static long max(long a, long b, long c)
max(a,max(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static long median(long a, long b, long c)
a
"cut" by the range
min(b,c)...max(b,c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static float min(float a, float b, float c)
min(a,min(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static float max(float a, float b, float c)
max(a,max(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static float median(float a, float b, float c)
a
"cut" by the range
min(b,c)...max(b,c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static double min(double a, double b, double c)
min(a,min(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static double max(double a, double b, double c)
max(a,max(b,c))
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static double median(double a, double b, double c)
a
"cut" by the range
min(b,c)...max(b,c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentpublic static boolean between(char a, char b, char c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("char" type)public static boolean between(byte a, byte b, byte c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("byte" type)public static boolean between(short a, short b, short c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("short" type)public static boolean between(int a, int b, int c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("int" type)public static boolean between(long a, long b, long c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("long" type)public static boolean between(float a, float b, float c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("float" type)public static boolean between(double a, double b, double c)
a >= min(b, c) && a <= max(b, c)
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumenttrue
if the a
value is between b
and c
values ("double" type)public static boolean between(float a, float b, float c, float epsilon)
a >= min(b, c) + epsilon && a <= max(b, c) - epsilon
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentepsilon
- permitted error of the checktrue
if the a
value is between b
and c
values with epsilon
error ("float" type)public static boolean between(double a, double b, double c, double epsilon)
a >= min(b, c) + epsilon && a <= max(b, c) - epsilon
.a
- 1st argumentb
- 2nd argumentc
- 3rd argumentepsilon
- permitted error of the checktrue
if the a
value is between b
and c
values with epsilon
error ("double" type)public static int sqr(int a)
a * a
a
- the argumentpublic static long sqr(long a)
a * a
a
- the argumentpublic static float sqr(float a)
a * a
a
- the argumentpublic static double sqr(double a)
a * a
a
- the argumentpublic static double sin(double a)
java.lang.StrictMath.sin(a)
a
- the argumentjava.lang.StrictMath.sin(a)
callpublic static double cos(double a)
java.lang.StrictMath.cos(a)
a
- the argumentjava.lang.StrictMath.cos(a)
callpublic static double tan(double a)
java.lang.StrictMath.tan(a)
a
- the argumentjava.lang.StrictMath.tan(a)
callpublic static double asin(double a)
java.lang.StrictMath.asin(a)
a
- the argumentjava.lang.StrictMath.asin(a)
callpublic static double acos(double a)
java.lang.StrictMath.acos(a)
a
- the argumentjava.lang.StrictMath.acos(a)
callpublic static double atan(double a)
java.lang.StrictMath.atan(a)
a
- the argumentjava.lang.StrictMath.atan(a)
callpublic static double toRadians(double a)
java.lang.StrictMath.toRadians(a)
a
- the argumentjava.lang.StrictMath.toRadians(a)
callpublic static double toDegrees(double a)
java.lang.StrictMath.toDegrees(a)
a
- the argumentjava.lang.StrictMath.toDegrees(a)
callpublic static double exp(double a)
java.lang.StrictMath.exp(a)
a
- the argumentjava.lang.StrictMath.exp(a)
callpublic static double log(double a)
java.lang.StrictMath.log(a)
a
- the argumentjava.lang.StrictMath.log(a)
callpublic static double sqrt(double a)
java.lang.StrictMath.sqrt(a)
a
- the argumentjava.lang.StrictMath.sqrt(a)
callpublic static double ceil(double a)
java.lang.StrictMath.ceil(a)
a
- the argumentjava.lang.StrictMath.ceil(a)
callpublic static double floor(double a)
java.lang.StrictMath.floor(a)
a
- the argumentjava.lang.StrictMath.floor(a)
callpublic static double rint(double a)
java.lang.StrictMath.rint(a)
a
- the argumentjava.lang.StrictMath.rint(a)
callpublic static double atan2(double a, double b)
java.lang.StrictMath.atan2(a,b)
a
- 1st argumentb
- 2nd argumentjava.lang.StrictMath.atan2(a,b)
callpublic static double IEEEremainder(double a, double b)
java.lang.StrictMath.IEEEremainder(a,b)
a
- 1st argumentb
- 2nd argumentjava.lang.StrictMath.IEEEremainder(a,b)
callpublic static double pow(double a, double b)
java.lang.StrictMath.pow(a,b)
a
- 1st argumentb
- 2nd argumentjava.lang.StrictMath.pow(a,b)
call