public final class Maths extends Object
| Modifier and Type | Field and Description |
|---|---|
static double |
E
mathematical constant e
|
static double |
HALF_PI |
static double |
PI
Mathematical constant Pi = 3.1415926...
|
static double |
QUARTER_PI |
static double |
ROOT_THREE |
static double |
ROOT_TWO |
static double |
TAU
Mathematical constant Tau = 2 * Pi
|
static double |
TWO_PI |
| Constructor and Description |
|---|
Maths() |
| Modifier and Type | Method and Description |
|---|---|
static double |
bound(double v,
double min,
double max)
Bound a value within a given range
|
static float |
bound(float v,
float min,
float max)
Bound a value within a given range
|
static int |
bound(int v,
int min,
int max)
Bound a value within a given range
|
static int |
clampToInteger(double value,
int min,
int max)
Clamp a double value to an integer range
|
static int |
clampToInteger(float value,
int min,
int max)
Clamp a float value to an integer range
|
static double |
frac(double a)
Return the (always non-negative) fractional part of a number
|
static float |
frac(float a)
Return the (always non-negative) fractional part of a number
|
static float |
inverseSigmoid(float a) |
static double |
max(double a,
double b,
double c)
Return the maximum of three values
|
static float |
max(float a,
float b)
Return the maximum of two numbers
|
static float |
max(float a,
float b,
float c)
Return the maximum of three values
|
static float |
max(float a,
float b,
float c,
float d)
Return the maximum of four values
|
static int |
max(int a,
int b)
Return the maximum of two numbers
|
static int |
max(int a,
int b,
int c)
Return the maximum of three numbers
|
static float |
middle(float a,
float b,
float c)
Return the middle value of 3 numbers
Can use faster "bound" method if first and last parameters are in order
|
static int |
middle(int a,
int b,
int c)
Return the middle value of 3 numbers
Can use faster "bound" method if first and last parameters are in order
|
static double |
min(double a,
double b,
double c)
Return the minimum of three values
|
static float |
min(float a,
float b)
Return the minimum of two numbers
|
static float |
min(float a,
float b,
float c)
Return the minimum of three values
|
static float |
min(float a,
float b,
float c,
float d)
Return the minimum of four values
|
static int |
min(int a,
int b)
Return the minimum of two numbers
|
static int |
min(int a,
int b,
int c)
Return the minimum of three numbers
|
static double |
mod(double num,
double div)
Double mod function with fractional divisor
|
static int |
mod(int number,
int divisor)
Integer modulus function
|
static boolean |
notNearZero(double d)
Tests whether a value is near zero, to a default tolerance level
|
static long |
quantize(long increase,
long boundary,
long base)
Detects the number of times that boundary is passed when adding increase to base
|
static int |
roundDown(double a)
Rounds down (integer floor) of a double value
|
static int |
roundDown(float a)
Round down to next smallest integer (towards negative infinity)
|
static int |
roundUp(double d)
Round up to next integer
|
static int |
roundUp(float d)
Round up to next integer
|
static int |
roundUp(Number d)
Round up to next integer
|
static double |
sigmoid(double a) |
static float |
sigmoid(float a) |
static float |
sigmoidDerivative(float a) |
static int |
sign(double a)
Return the sign of a double value
|
static int |
sign(float a)
Return the sign of a float value
|
static int |
sign(int a)
Return the sign of an int value
|
static int |
sign(long a)
Return the sign of a long value
|
static int |
sign2(int a)
Mike's fast integer sign algorithm
|
static double |
softMaximum(double x,
double y)
Soft maximum function
|
static double |
softplus(double a) |
static double |
sqrt(double a) |
static float |
sqrt(float a) |
static int |
square(byte b)
Return the square of a number
|
static double |
square(double x)
Return the square of a number
|
static float |
square(float x)
Return the square of a number
|
static int |
square(int x)
Return the square of a number
|
static double |
tanh(double a) |
static float |
tanh(float a) |
static float |
tanhDerivative(float a) |
static double |
tanhScaled(double a) |
static double |
tanhScaledDerivative(double a) |
static double |
triangleWave(double a)
Triangle wave with wavelength 1.0, and range 0.0 - 1.0
|
public static final double ROOT_TWO
public static final double ROOT_THREE
public static final double E
public static final double PI
public static final double TWO_PI
public static final double TAU
public static final double HALF_PI
public static final double QUARTER_PI
public static float sqrt(float a)
public static double sqrt(double a)
public static int clampToInteger(double value,
int min,
int max)
public static int clampToInteger(float value,
int min,
int max)
public static int middle(int a,
int b,
int c)
public static float middle(float a,
float b,
float c)
public static int sign(double a)
public static int sign(float a)
public static final int sign(int a)
public static final int sign2(int a)
a - public static int sign(long a)
public static int mod(int number,
int divisor)
n - numberd - divisorpublic static long quantize(long increase,
long boundary,
long base)
increase - boundary - base - public static double min(double a,
double b,
double c)
public static double max(double a,
double b,
double c)
public static float min(float a,
float b,
float c)
public static float max(float a,
float b,
float c)
public static final float min(float a,
float b,
float c,
float d)
public static final float max(float a,
float b,
float c,
float d)
public static int min(int a,
int b)
public static int max(int a,
int b)
public static float min(float a,
float b)
public static float max(float a,
float b)
public static int min(int a,
int b,
int c)
public static int max(int a,
int b,
int c)
public static float sigmoid(float a)
public static double sigmoid(double a)
public static double softplus(double a)
public static float tanh(float a)
public static double tanh(double a)
public static double tanhScaled(double a)
public static double tanhScaledDerivative(double a)
public static float inverseSigmoid(float a)
public static float sigmoidDerivative(float a)
public static float tanhDerivative(float a)
public static float frac(float a)
public static double frac(double a)
public static int square(byte b)
public static int square(int x)
public static float square(float x)
public static double square(double x)
public static int roundUp(double d)
public static int roundUp(Number d)
public static int roundUp(float d)
public static int roundDown(double a)
public static int roundDown(float a)
public static double softMaximum(double x,
double y)
public static final double bound(double v,
double min,
double max)
public static final float bound(float v,
float min,
float max)
public static final int bound(int v,
int min,
int max)
public static boolean notNearZero(double d)
public static double mod(double num,
double div)
public static double triangleWave(double a)
Copyright © 2012. All Rights Reserved.