public class FastestMathLibWrapper extends Object implements MathLibrary
FastMath
FastMath
StrictFastMath
Constructor and Description |
---|
FastestMathLibWrapper() |
Modifier and Type | Method and Description |
---|---|
double |
abs(double x)
Absolute value.
|
float |
abs(float x)
Absolute value.
|
int |
abs(int x)
Absolute value.
|
long |
abs(long x)
Absolute value.
|
double |
acos(double x)
Compute the arc cosine of a number.
|
double |
acosh(double a)
Compute the inverse hyperbolic cosine of a number.
|
double |
asin(double x)
Compute the arc sine of a number.
|
double |
asinh(double a)
Compute the inverse hyperbolic sine of a number.
|
double |
atan(double x)
Arctangent function
|
double |
atan2(double y,
double x)
Two arguments arctangent function
|
double |
atanh(double a)
Compute the inverse hyperbolic tangent of a number.
|
double |
cbrt(double x)
Compute the cubic root of a number.
|
double |
ceil(double x)
Get the smallest whole number larger than x.
|
double |
copySign(double magnitude,
double sign)
Returns the first argument with the sign of the second argument.
|
float |
copySign(float magnitude,
float sign)
Returns the first argument with the sign of the second argument.
|
double |
cos(double x)
Cosine function.
|
double |
cosh(double x)
Compute the hyperbolic cosine of a number.
|
double |
exp(double x)
Exponential function.
|
double |
expm1(double x)
Compute exp(x) - 1
|
double |
floor(double x)
Get the largest whole number smaller than x.
|
int |
getExponent(double d)
Return the exponent of a double number, removing the bias.
|
int |
getExponent(float f)
Return the exponent of a float number, removing the bias.
|
double |
hypot(double x,
double y)
Returns the hypotenuse of a triangle with sides
x and y -
sqrt(x2 +y2)avoiding intermediate overflow or underflow. |
double |
IEEEremainder(double dividend,
double divisor)
Computes the remainder as prescribed by the IEEE 754 standard.
|
double |
log(double x)
Natural logarithm.
|
double |
log10(double x)
Compute the base 10 logarithm.
|
double |
log1p(double x)
Computes log(1 + x).
|
double |
max(double a,
double b)
Compute the maximum of two values
|
float |
max(float a,
float b)
Compute the maximum of two values
|
int |
max(int a,
int b)
Compute the maximum of two values
|
long |
max(long a,
long b)
Compute the maximum of two values
|
double |
min(double a,
double b)
Compute the minimum of two values
|
float |
min(float a,
float b)
Compute the minimum of two values
|
int |
min(int a,
int b)
Compute the minimum of two values
|
long |
min(long a,
long b)
Compute the minimum of two values
|
double |
nextAfter(double d,
double direction)
Get the next machine representable number after a number, moving in the direction of another
number.
|
float |
nextAfter(float f,
double direction)
Get the next machine representable number after a number, moving in the direction of another
number.
|
double |
nextUp(double a)
Compute next number towards positive infinity.
|
float |
nextUp(float a)
Compute next number towards positive infinity.
|
double |
pow(double x,
double y)
Power function.
|
double |
pow(double d,
int e)
Raise a double to an int power.
|
double |
random()
Returns a pseudo-random number between 0.0 and 1.0.
|
double |
rint(double x)
Get the whole number that is the nearest to x, or the even one if x is exactly half way
between two integers.
|
long |
round(double x)
Get the closest long to x.
|
int |
round(float x)
Get the closest int to x.
|
double |
scalb(double d,
int n)
Multiply a double number by a power of 2.
|
float |
scalb(float f,
int n)
Multiply a float number by a power of 2.
|
double |
signum(double a)
Compute the signum of a number.
|
float |
signum(float a)
Compute the signum of a number.
|
double |
sin(double x)
Sine function.
|
double |
sinh(double x)
Compute the hyperbolic sine of a number.
|
double |
sqrt(double a)
Compute the square root of a number.
|
double |
tan(double x)
Tangent function.
|
double |
tanh(double x)
Compute the hyperbolic tangent of a number.
|
double |
toDegrees(double x)
Convert radians to degrees, with error of less than 0.5 ULP
|
double |
toRadians(double x)
Convert degrees to radians, with error of less than 0.5 ULP
|
double |
ulp(double x)
Compute least significant bit (Unit in Last Position) for a number.
|
float |
ulp(float x)
Compute least significant bit (Unit in Last Position) for a number.
|
public double sqrt(double a)
sqrt
in interface MathLibrary
a
- number on which evaluation is donepublic double cosh(double x)
cosh
in interface MathLibrary
x
- number on which evaluation is donepublic double sinh(double x)
sinh
in interface MathLibrary
x
- number on which evaluation is donepublic double tanh(double x)
tanh
in interface MathLibrary
x
- number on which evaluation is donepublic double acosh(double a)
acosh
in interface MathLibrary
a
- number on which evaluation is donepublic double asinh(double a)
asinh
in interface MathLibrary
a
- number on which evaluation is donepublic double atanh(double a)
atanh
in interface MathLibrary
a
- number on which evaluation is donepublic double signum(double a)
signum
in interface MathLibrary
a
- number on which evaluation is donepublic float signum(float a)
signum
in interface MathLibrary
a
- number on which evaluation is donepublic double nextUp(double a)
nextUp
in interface MathLibrary
a
- number to which neighbor should be computedpublic float nextUp(float a)
nextUp
in interface MathLibrary
a
- number to which neighbor should be computedpublic double random()
random
in interface MathLibrary
public double exp(double x)
exp
in interface MathLibrary
x
- a doublepublic double expm1(double x)
expm1
in interface MathLibrary
x
- number to compute shifted exponentialpublic double log(double x)
log
in interface MathLibrary
x
- a doublepublic double log1p(double x)
log1p
in interface MathLibrary
x
- Number.log(1 + x)
.public double log10(double x)
log10
in interface MathLibrary
x
- a numberpublic double pow(double x, double y)
pow
in interface MathLibrary
x
- a doubley
- a doublepublic double pow(double d, int e)
pow
in interface MathLibrary
d
- Number to raise.e
- Exponent.public double sin(double x)
sin
in interface MathLibrary
x
- Argument.public double cos(double x)
cos
in interface MathLibrary
x
- Argument.public double tan(double x)
tan
in interface MathLibrary
x
- Argument.public double atan(double x)
atan
in interface MathLibrary
x
- a numberpublic double atan2(double y, double x)
atan2
in interface MathLibrary
y
- ordinatex
- abscissa-PI
and PI
public double asin(double x)
asin
in interface MathLibrary
x
- number on which evaluation is donepublic double acos(double x)
acos
in interface MathLibrary
x
- number on which evaluation is donepublic double cbrt(double x)
cbrt
in interface MathLibrary
x
- number on which evaluation is donepublic double toRadians(double x)
toRadians
in interface MathLibrary
x
- angle in degreespublic double toDegrees(double x)
toDegrees
in interface MathLibrary
x
- angle in radianspublic int abs(int x)
abs
in interface MathLibrary
x
- number from which absolute value is requestedpublic long abs(long x)
abs
in interface MathLibrary
x
- number from which absolute value is requestedpublic float abs(float x)
abs
in interface MathLibrary
x
- number from which absolute value is requestedpublic double abs(double x)
abs
in interface MathLibrary
x
- number from which absolute value is requestedpublic double ulp(double x)
ulp
in interface MathLibrary
x
- number from which ulp is requestedpublic float ulp(float x)
ulp
in interface MathLibrary
x
- number from which ulp is requestedpublic double scalb(double d, int n)
scalb
in interface MathLibrary
d
- number to multiplyn
- power of 2public float scalb(float f, int n)
scalb
in interface MathLibrary
f
- number to multiplyn
- power of 2public double nextAfter(double d, double direction)
The ordering is as follows (increasing):
If arguments compare equal, then the second argument is returned.
If direction
is greater than d
, the smallest machine representable number strictly greater than
d
is returned; if less, then the largest representable number strictly less than d
is returned.
If d
is infinite and direction does not bring it back to finite numbers, it is returned unchanged.
nextAfter
in interface MathLibrary
d
- base numberdirection
- (the only important thing is whether direction
is greater or smaller than d
)public float nextAfter(float f, double direction)
The ordering is as follows (increasing):
If arguments compare equal, then the second argument is returned.
If direction
is greater than f
, the smallest machine representable number strictly greater than
f
is returned; if less, then the largest representable number strictly less than f
is returned.
If f
is infinite and direction does not bring it back to finite numbers, it is returned unchanged.
nextAfter
in interface MathLibrary
f
- base numberdirection
- (the only important thing is whether direction
is greater or smaller than f
)public double floor(double x)
floor
in interface MathLibrary
x
- number from which floor is requestedpublic double ceil(double x)
ceil
in interface MathLibrary
x
- number from which ceil is requestedpublic double rint(double x)
rint
in interface MathLibrary
x
- number from which nearest whole number is requestedpublic long round(double x)
round
in interface MathLibrary
x
- number from which closest long is requestedpublic int round(float x)
round
in interface MathLibrary
x
- number from which closest int is requestedpublic int min(int a, int b)
min
in interface MathLibrary
a
- first valueb
- second valuepublic long min(long a, long b)
min
in interface MathLibrary
a
- first valueb
- second valuepublic float min(float a, float b)
min
in interface MathLibrary
a
- first valueb
- second valuepublic double min(double a, double b)
min
in interface MathLibrary
a
- first valueb
- second valuepublic int max(int a, int b)
max
in interface MathLibrary
a
- first valueb
- second valuepublic long max(long a, long b)
max
in interface MathLibrary
a
- first valueb
- second valuepublic float max(float a, float b)
max
in interface MathLibrary
a
- first valueb
- second valuepublic double max(double a, double b)
max
in interface MathLibrary
a
- first valueb
- second valuepublic double hypot(double x, double y)
x
and y
-
sqrt(x2 +y2)hypot
in interface MathLibrary
x
- a valuey
- a valuepublic double IEEEremainder(double dividend, double divisor)
x - y*n
where n
is the mathematical integer closest
to the exact mathematical value of the quotient x/y
. If two mathematical integers are
equally close to x/y
then n
is the integer that is even.
IEEEremainder
in interface MathLibrary
dividend
- the number to be divideddivisor
- the number by which to dividepublic double copySign(double magnitude, double sign)
sign
argument
is treated as positive.copySign
in interface MathLibrary
magnitude
- the value to returnsign
- the sign for the returned valuesign
argumentpublic float copySign(float magnitude, float sign)
sign
argument
is treated as positive.copySign
in interface MathLibrary
magnitude
- the value to returnsign
- the sign for the returned valuesign
argumentpublic int getExponent(double d)
For double numbers of the form 2x, the unbiased exponent is exactly x.
getExponent
in interface MathLibrary
d
- number from which exponent is requestedpublic int getExponent(float f)
For float numbers of the form 2x, the unbiased exponent is exactly x.
getExponent
in interface MathLibrary
f
- number from which exponent is requestedCopyright © 2019 CNES. All rights reserved.