activemq-cpp-3.4.0
|
The class Math
contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
More...
#include <src/main/decaf/lang/Math.h>
Public Member Functions | |
Math () | |
virtual | ~Math () |
Static Public Member Functions | |
static int | abs (int value) |
Returns the absolute value of an int value. | |
static long long | abs (long long value) |
Returns the absolute value of an long long value. | |
static float | abs (float value) |
Returns the absolute value of a float value. | |
static double | abs (double value) |
Returns the absolute value of a double value. | |
static double | sqrt (double value) |
Returns the arc cosine of an angle, in the range of 0.0 through pi. | |
static double | pow (double base, double exp) |
Returns the value of the first argument raised to the power of the second argument. | |
static short | min (short a, short b) |
Returns the double value that is closest in value to the argument and is equal to a mathematical integer. | |
static int | min (int a, int b) |
Returns the smaller of two int values. | |
static unsigned int | min (unsigned int a, unsigned int b) |
Returns the smaller of two unsigned int values. | |
static long long | min (long long a, long long b) |
Returns the smaller of two long long values. | |
static float | min (float a, float b) |
Returns the smaller of two float values. | |
static double | min (double a, double b) |
Returns the smaller of two double values. | |
static short | max (short a, short b) |
Returns the larger of two short values. | |
static int | max (int a, int b) |
Returns the larger of two int values. | |
static long long | max (long long a, long long b) |
Returns the larger of two long long values. | |
static float | max (float a, float b) |
Returns the greater of two float values. | |
static double | max (double a, double b) |
Returns the greater of two double values. | |
static double | ceil (double value) |
Returns the natural logarithm (base e) of a double value. | |
static double | floor (double value) |
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. | |
static int | round (float value) |
Returns the closest int to the argument. | |
static long long | round (double value) |
Returns the closest long long to the argument. | |
static double | random () |
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. | |
static float | signum (float value) |
Returns Euler's number e raised to the power of a double value. | |
static double | signum (double value) |
Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero. | |
static double | toRadians (double angdeg) |
Returns the measure in radians of the supplied degree angle. | |
static double | toDegrees (double angrad) |
Returns the measure in degrees of the supplied radian angle. | |
Static Public Attributes | |
static const double | E |
static const double | PI |
The class Math
contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
decaf::lang::Math::Math | ( | ) | [inline] |
virtual decaf::lang::Math::~Math | ( | ) | [inline, virtual] |
static int decaf::lang::Math::abs | ( | int | value | ) | [inline, static] |
Returns the absolute value of an int value.
If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.
value | - the value to return the abs of |
static long long decaf::lang::Math::abs | ( | long long | value | ) | [inline, static] |
Returns the absolute value of an long long value.
If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.
value | - the value to return the abs of |
static double decaf::lang::Math::abs | ( | double | value | ) | [static] |
Returns the absolute value of a double value.
If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases:
o If the argument is positive zero or negative zero, the result is positive zero. o If the argument is infinite, the result is positive infinity. o If the argument is NaN, the result is NaN.
In other words, the result is the same as the value of the expression: Double::longBitsToDouble( 0x7fffffffffffffffULL & Double::doubleToLongBits( value ) )
value | - the value to return the abs of |
static float decaf::lang::Math::abs | ( | float | value | ) | [static] |
Returns the absolute value of a float value.
If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases:
o If the argument is positive zero or negative zero, the result is positive zero. o If the argument is infinite, the result is positive infinity. o If the argument is NaN, the result is NaN.
In other words, the result is the same as the value of the expression: Float::intBitsToFloat( 0x7fffffff & Float::floatToIntBits( value ) )
value | - the value to return the abs of |
static double decaf::lang::Math::ceil | ( | double | value | ) | [static] |
Returns the natural logarithm (base e) of a double value.
Special cases:
o If the argument is NaN or less than zero, then the result is NaN. o If the argument is positive infinity, then the result is positive infinity. o If the argument is positive zero or negative zero, then the result is negative infinity.
value | the value to compute the natural log of. |
o If the argument is NaN or less than zero, then the result is NaN. o If the argument is positive infinity, then the result is positive infinity. o If the argument is positive zero or negative zero, then the result is negative infinity. o If the argument is equal to 10n for integer n, then the result is n.
value | - the value to operate on |
Special cases:
o If the argument is NaN or less than -1, then the result is NaN. o If the argument is positive infinity, then the result is positive infinity. o If the argument is negative one, then the result is negative infinity. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the value to operate on |
o If the argument value is already equal to a mathematical integer, then the result is the same as the argument. o If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument. o If the argument value is less than zero but greater than -1.0, then the result is negative zero.
Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x).
value | - the value to find the ceiling of |
static double decaf::lang::Math::floor | ( | double | value | ) | [static] |
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
Special cases:
o If the argument value is already equal to a mathematical integer, then the result is the same as the argument. o If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
value | - the value to find the floor of |
static float decaf::lang::Math::max | ( | float | a, |
float | b | ||
) | [static] |
Returns the greater of two float values.
That is, the result is the argument closer to positive infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero, the result is positive zero.
a | - an argument. |
b | - another argument. |
a
and b
. static double decaf::lang::Math::max | ( | double | a, |
double | b | ||
) | [static] |
Returns the greater of two double values.
That is, the result is the argument closer to positive infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other negative zero, the result is positive zero.
a | - an argument. |
b | - another argument. |
a
and b
. static short decaf::lang::Math::max | ( | short | a, |
short | b | ||
) | [inline, static] |
Returns the larger of two short
values.
That is, the result the argument closer to the value of Short::MAX_VALUE
. If the arguments have the same value, the result is that same value.
a | - an argument. |
b | - another argument. |
a
and b
. static int decaf::lang::Math::max | ( | int | a, |
int | b | ||
) | [inline, static] |
Returns the larger of two int
values.
That is, the result the argument closer to the value of Integer::MAX_VALUE
. If the arguments have the same value, the result is that same value.
a | - an argument. |
b | - another argument. |
a
and b
. static long long decaf::lang::Math::max | ( | long long | a, |
long long | b | ||
) | [inline, static] |
Returns the larger of two long long
values.
That is, the result the argument closer to the value of Long::MAX_VALUE
. If the arguments have the same value, the result is that same value.
a | - an argument. |
b | - another argument. |
a
and b
. static int decaf::lang::Math::min | ( | int | a, |
int | b | ||
) | [inline, static] |
Returns the smaller of two int
values.
That is, the result the argument closer to the value of Integer::MIN_VALUE
. If the arguments have the same value, the result is that same value.
a | - an argument. |
b | - another argument. |
a
and b
. static unsigned int decaf::lang::Math::min | ( | unsigned int | a, |
unsigned int | b | ||
) | [inline, static] |
Returns the smaller of two unsigned int
values.
That is, the result the argument closer to the value of Integer::MIN_VALUE
. If the arguments have the same value, the result is that same value.
a | - an argument. |
b | - another argument. |
a
and b
. static long long decaf::lang::Math::min | ( | long long | a, |
long long | b | ||
) | [inline, static] |
Returns the smaller of two long long
values.
That is, the result the argument closer to the value of Long::MIN_VALUE
. If the arguments have the same value, the result is that same value.
a | - an argument. |
b | - another argument. |
a
and b
. static float decaf::lang::Math::min | ( | float | a, |
float | b | ||
) | [static] |
Returns the smaller of two float values.
That is, the result is the value closer to negative infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero, the result is negative zero.
a | - an argument. |
b | - another argument. |
a
and b
. static double decaf::lang::Math::min | ( | double | a, |
double | b | ||
) | [static] |
Returns the smaller of two double values.
That is, the result is the value closer to negative infinity. If the arguments have the same value, the result is that same value. If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero. If one argument is positive zero and the other is negative zero, the result is negative zero.
a | - an argument. |
b | - another argument. |
a
and b
. static short decaf::lang::Math::min | ( | short | a, |
short | b | ||
) | [inline, static] |
Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
If two double values that are mathematical integers are equally close, the result is the integer value that is even. Special cases:
o If the argument value is already equal to a mathematical integer, then the result is the same as the argument. o If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
value | - the value to round to the nearest integer |
decaf.lang.Short::MIN_VALUE
. If the arguments have the same value, the result is that same value. a | - an argument. |
b | - another argument. |
a
and b
. Referenced by decaf::util::concurrent::LinkedBlockingQueue< E >::drainTo().
static double decaf::lang::Math::pow | ( | double | base, |
double | exp | ||
) | [static] |
Returns the value of the first argument raised to the power of the second argument.
Special cases:
o If the second argument is positive or negative zero, then the result is 1.0. o If the second argument is 1.0, then the result is the same as the first argument. o If the second argument is NaN, then the result is NaN. o If the first argument is NaN and the second argument is nonzero, then the result is NaN.
base | - the base |
exp | - the exponent |
static double decaf::lang::Math::random | ( | ) | [static] |
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
The remainder value is mathematically equal to f1 - f2 × n, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2, and if two mathematical integers are equally close to f1/f2, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument. Special cases:
o If either argument is NaN, or the first argument is infinite, or the second argument is positive zero or negative zero, then the result is NaN. o If the first argument is finite and the second argument is infinite, then the result is the same as the first argument.
f1 | - the dividend. |
f2 | - the divisor |
When this method is first called, it creates a single new pseudorandom-number generator; This new pseudorandom-number generator is used thereafter for all calls to this method and is used nowhere else.
This method is properly synchronized to allow correct use by more than one thread. However, if many threads need to generate pseudorandom numbers at a great rate, it may reduce contention for each thread to have its own pseudorandom-number generator.
static long long decaf::lang::Math::round | ( | double | value | ) | [static] |
Returns the closest long long to the argument.
The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long long. In other words, the result is equal to the value of the expression: (long long)Math.floor(a + 0.5d)
o If the argument is NaN, the result is 0. o If the argument is negative infinity or any value less than or equal to the value of Long::MIN_VALUE, the result is equal to the value of Long::MIN_VALUE. o If the argument is positive infinity or any value greater than or equal to the value of Long::MAX_VALUE, the result is equal to the value of Long::MAX_VALUE.
value | - the value to round |
static int decaf::lang::Math::round | ( | float | value | ) | [static] |
Returns the closest int to the argument.
The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type int. In other words, the result is equal to the value of the expression: (int)Math.floor( a + 0.5f )
o If the argument is NaN, the result is 0. o If the argument is negative infinity or any value less than or equal to the value of Integer::MIN_VALUE, the result is equal to the value of Integer::MIN_VALUE. o If the argument is positive infinity or any value greater than or equal to the value of Integer::MAX_VALUE, the result is equal to the value of Integer::MAX_VALUE.
value | - the value to round |
static double decaf::lang::Math::signum | ( | double | value | ) | [static] |
Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.
Special Cases:
o If the argument is NaN, then the result is NaN. o If the argument is positive zero or negative zero, then the result is the same as the argument.
value | - the floating-point value whose signum is to be returned |
static float decaf::lang::Math::signum | ( | float | value | ) | [static] |
Returns Euler's number e raised to the power of a double value.
Special cases:
o If the argument is NaN, the result is NaN. o If the argument is positive infinity, then the result is positive infinity. o If the argument is negative infinity, then the result is positive zero.
value | - the exponent to raise e to |
o If the argument is NaN, the result is NaN. o If the argument is positive infinity, then the result is positive infinity. o If the argument is negative infinity, then the result is -1.0. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the value to raise e^x - 1 |
If either argument is infinite, then the result is positive infinity. If either argument is NaN and neither argument is infinite, then the result is NaN.
x | - an argument |
y | - another argument |
o If the argument is NaN, then the result is NaN. o If the argument is positive zero or negative zero, then the result is the same as the argument.
value | - the floating-point value whose signum is to be returned |
static double decaf::lang::Math::sqrt | ( | double | value | ) | [static] |
Returns the arc cosine of an angle, in the range of 0.0 through pi.
Special case:
o If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
value | - the value to return the arc cosine of. |
o If the argument is NaN or its absolute value is greater than 1, then the result is NaN. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the value to return the arc cosine of. |
o If the argument is NaN, then the result is NaN. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the value to return the arc cosine of. |
o If either argument is NaN, then the result is NaN. o If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero. o If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero. o If the first argument is positive zero and the second argument is negative, or the first argument is positive and finite and the second argument is negative infinity, then the result is the double value closest to pi. o If the first argument is negative zero and the second argument is negative, or the first argument is negative and finite and the second argument is negative infinity, then the result is the double value closest to -pi. o If the first argument is positive and the second argument is positive zero or negative zero, or the first argument is positive infinity and the second argument is finite, then the result is the double value closest to pi/2. o If the first argument is negative and the second argument is positive zero or negative zero, or the first argument is negative infinity and the second argument is finite, then the result is the double value closest to -pi/2. o If both arguments are positive infinity, then the result is the double value closest to pi/4. o If the first argument is positive infinity and the second argument is negative infinity, then the result is the double value closest to 3*pi/4. o If the first argument is negative infinity and the second argument is positive infinity, then the result is the double value closest to -pi/4. o If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.
y | - the ordinate coordinate |
x | - the abscissa coordinate |
o If the argument is NaN, then the result is NaN. o If the argument is infinite, then the result is an infinity with the same sign as the argument. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the double to compute the cube root of |
o If the argument is NaN or an infinity, then the result is NaN.
value | - an value in radians |
o If the argument is NaN, then the result is NaN. o If the argument is infinite, then the result is positive infinity. o If the argument is zero, then the result is 1.0.
value | - the number whose hyperbolic cosine is to be found |
o If the argument is NaN or an infinity, then the result is NaN. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the number whose sin is to be found |
o If the argument is NaN, then the result is NaN. o If the argument is infinite, then the result is an infinity with the same sign as the argument. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the number whose hyperbolic sin is to be found |
o If the argument is NaN or an infinity, then the result is NaN. o If the argument is zero, then the result is a zero with the same sign as the argument.
value | - the number whose tangent is to be found |
o If the argument is NaN, then the result is NaN. o If the argument is zero, then the result is a zero with the same sign as the argument. o If the argument is positive infinity, then the result is +1.0. o If the argument is negative infinity, then the result is -1.0.
value | - the number whose hyperbolic tangent is to be found |
o If the argument is NaN or less than zero, then the result is NaN. o If the argument is positive infinity, then the result is positive infinity. o If the argument is positive zero or negative zero, then the result is the same as the argument.
Otherwise, the result is the double value closest to the true mathematical square root of the argument value.
value | - the value to find the square root of |
the | square root of the argument. |
static double decaf::lang::Math::toDegrees | ( | double | angrad | ) | [inline, static] |
Returns the measure in degrees of the supplied radian angle.
angrad | - an angle in radians |
static double decaf::lang::Math::toRadians | ( | double | angdeg | ) | [inline, static] |
Returns the measure in radians of the supplied degree angle.
angdeg | - an angle in degrees |
const double decaf::lang::Math::E [static] |
const double decaf::lang::Math::PI [static] |