Class MissingMath
java.lang.Object
org.ojalgo.function.special.MissingMath
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BigDecimal[]Coefficients for the Taylor series expansion of the exponential function.private static final MathContextBinary 256 octuple precision roughly corresponds to 71.34 decimal digits. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleacosh(double arg) static doubleasinh(double arg) static doubleatan2(double y, double x) https://math.stackexchange.com/questions/1098487/atan2-faster-approximation/1105038static doubleatanh(double arg) static BigDecimalcos(BigDecimal arg) static BigDecimaldivide(BigDecimal numerator, BigDecimal denominator) private static BigDecimaldoInternalCos(BigDecimal arg) static BigDecimalexp(BigDecimal arg) static doublefactorial(int arg) 13!does not fit in anint, and21!does not fit in along- that's why this method returns adouble.(package private) static doublefactorialDouble(int arg) (package private) static intfactorialInt(int arg) (package private) static longfactorialLong(int arg) static intgcd(int[] vals) static intgcd(int val1, int val2) Greatest Common Denominatorstatic intgcd(int val1, int... vals) static longgcd(long[] vals) static longgcd(long val1, long val2) Greatest Common Denominatorstatic longgcd(long val1, long... vals) static doublehypot(double arg1, double arg2) static BigDecimalhypot(BigDecimal arg1, BigDecimal arg2) static BigDecimallog(BigDecimal arg) static doublelog10(double arg, double replacement) For very small arguments (regardless of sign) the replacement is returned insteadstatic doublelogistic(double arg) static doublelogit(double arg) static intmagnitude(BigDecimal arg) Returns a rough approximation ofMath.log10(double)forBigDecimal.static doublemax(double... values) static doublemax(double a, double b) static doublemax(double a, double b, double c) static doublemax(double a, double b, double c, double d) static intmax(int... values) static intmax(int a, int b) static intmax(int a, int b, int c) static intmax(int a, int b, int c, int d) static longmax(long... values) static longmax(long a, long b) static longmax(long a, long b, long c) static longmax(long a, long b, long c, long d) static doublemin(double... values) static doublemin(double a, double b) static doublemin(double a, double b, double c) static doublemin(double a, double b, double c, double d) static intmin(int... values) static intmin(int a, int b) static intmin(int a, int b, int c) static intmin(int a, int b, int c, int d) static longmin(long... values) static longmin(long a, long b) static longmin(long a, long b, long c) static longmin(long a, long b, long c, long d) static doublenorm(double... values) static doublenorm(double a, double b) static doublenorm(double a, double b, double c) static doublenorm(double a, double b, double c, double d) static BigDecimalpow(BigDecimal arg1, BigDecimal arg2) static doublepower(double arg, int param) static longpower(long arg, int param) static BigDecimalpower(BigDecimal arg, int param) static doubleroot(double arg, int param) static BigDecimalroot(BigDecimal arg, int param) static introundToInt(double value) static doublescale(double arg, int param) static BigDecimalsignum(BigDecimal arg) static BigDecimalsin(BigDecimal arg) static doublesqrt1px2(double arg) static BigDecimaltanh(BigDecimal arg) static inttoMinIntExact(long... values) static inttoMinIntExact(long a, long b) static inttoMinIntExact(long a, long b, long c) static inttoMinIntExact(long a, long b, long c, long d)
-
Field Details
-
EXP_COEF
Coefficients for the Taylor series expansion of the exponential function. -
MC256
Binary 256 octuple precision roughly corresponds to 71.34 decimal digits. Here we set it higher (for intermediate calculations) to enable end-results that are accurate to 71 decimal digits.https://en.wikipedia.org/wiki/IEEE_754
-
-
Constructor Details
-
MissingMath
public MissingMath()
-
-
Method Details
-
acosh
public static double acosh(double arg) -
asinh
public static double asinh(double arg) -
atan2
public static double atan2(double y, double x) https://math.stackexchange.com/questions/1098487/atan2-faster-approximation/1105038
This is about 10x faster thanMath.atan2(double, double) -
atanh
public static double atanh(double arg) -
cos
-
divide
-
exp
-
factorial
public static double factorial(int arg) 13!does not fit in anint, and21!does not fit in along- that's why this method returns adouble. -
gcd
public static int gcd(int val1, int val2) Greatest Common Denominator -
gcd
public static int gcd(int val1, int... vals) -
gcd
public static int gcd(int[] vals) -
gcd
public static long gcd(long val1, long... vals) -
gcd
public static long gcd(long val1, long val2) Greatest Common Denominator -
gcd
public static long gcd(long[] vals) -
hypot
-
hypot
public static double hypot(double arg1, double arg2) -
log
-
log10
public static double log10(double arg, double replacement) For very small arguments (regardless of sign) the replacement is returned instead -
logistic
public static double logistic(double arg) -
logit
public static double logit(double arg) -
magnitude
Returns a rough approximation ofMath.log10(double)forBigDecimal.- For numbers like 10^n it returns the exact correct number, n.
- The magnitude of 0.0 is 0.
- The error is [0.0,1.0) and the returned value is never more than the actual/correct value. For 999.0 the correct value is close to 3, but this method returns 2, as the implementation simply counts the digits.
- Works for negative numbers as the sign is disregarded.
- Works for fractional numbers 0.1, 0.0456, 1.2 or whatever.
-
max
public static double max(double... values) -
max
public static double max(double a, double b) -
max
public static double max(double a, double b, double c) -
max
public static double max(double a, double b, double c, double d) -
max
public static int max(int... values) -
max
public static int max(int a, int b) -
max
public static int max(int a, int b, int c) -
max
public static int max(int a, int b, int c, int d) -
max
public static long max(long... values) -
max
public static long max(long a, long b) -
max
public static long max(long a, long b, long c) -
max
public static long max(long a, long b, long c, long d) -
min
public static double min(double... values) -
min
public static double min(double a, double b) -
min
public static double min(double a, double b, double c) -
min
public static double min(double a, double b, double c, double d) -
min
public static int min(int... values) -
min
public static int min(int a, int b) -
min
public static int min(int a, int b, int c) -
min
public static int min(int a, int b, int c, int d) -
min
public static long min(long... values) -
min
public static long min(long a, long b) -
min
public static long min(long a, long b, long c) -
min
public static long min(long a, long b, long c, long d) -
norm
public static double norm(double... values) -
norm
public static double norm(double a, double b) -
norm
public static double norm(double a, double b, double c) -
norm
public static double norm(double a, double b, double c, double d) -
pow
-
power
-
power
public static double power(double arg, int param) -
power
public static long power(long arg, int param) -
root
-
root
public static double root(double arg, int param) -
roundToInt
public static int roundToInt(double value) -
scale
public static double scale(double arg, int param) -
signum
-
sin
-
sqrt1px2
public static double sqrt1px2(double arg) -
tanh
-
toMinIntExact
public static int toMinIntExact(long... values) -
toMinIntExact
public static int toMinIntExact(long a, long b) -
toMinIntExact
public static int toMinIntExact(long a, long b, long c) -
toMinIntExact
public static int toMinIntExact(long a, long b, long c, long d) -
doInternalCos
-
factorialDouble
static double factorialDouble(int arg) -
factorialInt
static int factorialInt(int arg) -
factorialLong
static long factorialLong(int arg)
-