public class FastMath extends Object
Math
and SpecialMath
. This speed comes at the cost of
correctness, and in general the methods in this class attempt to have a
relative error no worse than 10-3 for most inputs. Constructor and Description |
---|
FastMath() |
Modifier and Type | Method and Description |
---|---|
static double |
digamma(double x)
Computes the digamma function of the input
|
static double |
exp(double x)
Exponentiates the given input value
|
static double |
log(double x)
Computes the natural logarithm of the input
|
static double |
log2_2pd1(double x)
Computes log2(x) using a Pade approximation.
|
static double |
log2_c11(double x)
Computes log2(x) using a cache of 211 values,
consuming approximately 17 kilobytes of memory.
The results are generally accurate to an absolute and relative error of 10-4 |
static double |
log2(double x)
Computes log2(x)
|
static double |
pow(double a,
double b)
Computes ab.
|
static double |
pow2(double x)
Computes 2x.
The results are generally accurate to an relative error of 10-4, but can be as accurate as 10-10 |
static double |
pow2(int x)
Computes 2x exactly be exploiting the IEEE format
|
public static double log(double x)
x
- the inputpublic static double log2(double x)
x
- the inputx
public static double log2_2pd1(double x)
log2_c11(double)
but dose not use any extra memory. x
- the inputx
public static double log2_c11(double x)
x
- the inputx
public static double pow2(int x)
x
- the integer power to raise 2 toopublic static double pow2(double x)
x
- the power to raise topublic static double pow(double a, double b)
a
- the baseb
- the powerpublic static double exp(double x)
x
- the inputpublic static double digamma(double x)
x
- the input valueCopyright © 2017. All rights reserved.