Class MathUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final longstatic final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleabs(double p_dblX) Returns the absolute value of a double value.floatabs(float p_fltX) Returns the absolute value of a float value.intabs(int p_iX) Returns the absolute value of an int value.longabs(long p_lX) Returns the absolute value of a long value.Adds two numbers.doubleceil(double p_dbl) Returns the smallest double value that is greater than or equal to the argument and is equal to a mathematical integer.doubleCalculate the x-coordinate of a point on a ellipse.doubleCalculate the x-coordinate of a point on a ellipse.intcircleXInt(Number p_numX, Number p_numRadius, Number p_numAngle) Calculate the x-coordinate of a point on a ellipse.intcircleXInt(Number p_numX, Number p_numRadius, Number p_numNum, Number p_numDenom) Calculate the x-coordinate of a point on a ellipse.doubleCalculate the y-coordinate of a point on a ellipse.doubleCalculate the y-coordinate of a point on a ellipse.intcircleYInt(Number p_numY, Number p_numRadius, Number p_numAngle) Calculate the y-coordinate of a point on a ellipse.intcircleYInt(Number p_numY, Number p_numRadius, Number p_numNum, Number p_numDenom) Calculate the y-coordinate of a point on a ellipse.doubleGet the trigonometric cosine of the given angle.doubleGet the trigonometric cosine of the given angle.doubleConvert degrees to radians.Divides one number by another.doubleReturns Euler's number e raised to given power as adouble.doublefloor(double p_dbl) Returns the largest double value that is less than or equal to the argument and is equal to a mathematical integer.booleanDetermine if the first number is greater or equal as the second number.doublegetPI()Get the value of π, i.e.intgetRandomInt(int p_iMinValue, int p_iMaxValue) longgetRandomLong(long p_lMinValue, long p_lMaxValue) booleanDetermine if the first number is greater than the second number.intDivides theintpart of first number by theintpart of the second.intCalculates theintpart of first number modulo theintpart of the second.booleanisInfinite(double p_dbl) Check if the specified number is infinitely large in magnitude.booleanisInfinite(float p_flt) Check if the specified number is infinitely large in magnitude.booleanisNaN(double p_dbl) Check if the specified number is a Not-a-Number (NaN) value.booleanisNaN(float p_flt) Check if the specified number is a Not-a-Number (NaN) value.longDivides thelongpart of first number by thelongpart of the second.booleanDetermine if the first number is less or equal the second number.longCalculates thelongpart of first number modulo thelongpart of the second.doubleReturns the natural logarithm (base e) of the given number as adouble.doubleReturns the logarithm to base10of the given number as adouble.booleanDetermine if the first number is less than the second number.Determine the maximum of the given numbers.Determine the minimum of the given numbers.Multiplies two numbers.doubleReturns the value of the first argument raised to the power of the second argument as adouble.doubleConvert radians to degrees.doubleConvert a ratio to radians.doubleroundHalfAwayFromZero(double p_dbl) Returns the closest integer to the argument.doubleroundHalfAwayFromZero(double p_dbl, int p_iPrecision) Returns the closest scaled integer to the argument.Returns the closest integer to the argument.roundHalfAwayFromZero(BigDecimal p_bd, int p_iPrecision) Returns the closest scaled integer to the argument.introundHalfAwayFromZeroAsInt(double p_dbl) Returns the closestintto the argument.longroundHalfAwayFromZeroAsLong(double p_dbl) Returns the closestlongto the argument.doubleroundHalfEven(double p_dbl) Returns the closest integer to the argument.doubleroundHalfEven(double p_dbl, int p_iPrecision) Returns the closest integer to the argument.roundHalfEven(BigDecimal p_bd) Returns the closest integer to the argument.roundHalfEven(BigDecimal p_bd, int p_iPrecision) Returns the closest scaled integer to the argument.introundHalfEvenAsInt(double p_dbl) Returns the closest integer to the argument.longroundHalfEvenAsLong(double p_dbl) Returns the closest integer to the argument.doubleroundHalfUp(double p_dbl) Returns the closest integer to the argument.introundHalfUpAsInt(double p_dbl) Returns the closestintto the argument.longroundHalfUpAsLong(double p_dbl) Returns the closestlongto the argument.intReturns the signum function of the argument.doubleGet the trigonometric sine of the given angle.doubleGet the trigonometric sine of the given angle.Subtract two numbers.doubleGet the trigonometric tangent of the given angle.doubleGet the trigonometric tangent of the given angle.toBigDecimal(Object p_value) Cast the given value to big decimal.toBigDecimal(Object p_value, BigDecimal p_lngFallback) Cast the given value to big decimal.Cast the given value to double.Cast the given value to double.IValueHolder<?> toDoubleVH(Object p_value) Cast the given value to double and wrap it into a value holder.IValueHolder<?> toDoubleVH(Object p_value, Double p_dblFallback) Cast the given value to double and wrap it into a value holder.Cast the given value to float.Cast the given value to float.intCast the given value to integer.Cast the given value to integer.IValueHolder<?> toIntegerVH(Object p_value) Cast the given value to integer and wrap it into a value holder.IValueHolder<?> toIntegerVH(Object p_value, Integer p_intFallback) Cast the given value to integer and wrap it into a value holder.longCast the given value to long.Cast the given value to long.IValueHolder<?> Cast the given value to long and wrap it into a value holder.IValueHolder<?> Cast the given value to long and wrap it into a value holder.
-
Field Details
-
INT_MIN_VALUE
public static final int INT_MIN_VALUE- See Also:
-
INT_MAX_VALUE
public static final int INT_MAX_VALUE- See Also:
-
LONG_MIN_VALUE
public static final long LONG_MIN_VALUE- See Also:
-
LONG_MAX_VALUE
public static final long LONG_MAX_VALUE- See Also:
-
-
Constructor Details
-
MathUtil
public MathUtil()
-
-
Method Details
-
toInteger
Cast the given value to integer.Valid input types are
java.lang.Number,java.lang.Boolean, value holders, or strings (that must not contain decimal grouping symbols).- Parameters:
p_value- The value to be cast.- Returns:
- The integer value.
- Throws:
ArithmeticException- In case of a range overflow.NumberFormatException- If a given string cannot be parsed as an integer.
-
toIntegerVH
Cast the given value to integer and wrap it into a value holder.- See Also:
-
toInteger
Cast the given value to integer.- Parameters:
p_value- The integer value.p_intFallback- The fallback value ifp_valueisnull.- Returns:
- The integer value.
- See Also:
-
toIntegerVH
Cast the given value to integer and wrap it into a value holder.- See Also:
-
toLong
Cast the given value to long.Valid input types are
java.lang.Number,java.lang.Boolean, value holders, or strings (that must not contain decimal grouping symbols).- Parameters:
p_value- The value to be cast.- Returns:
- The long value.
- Throws:
ArithmeticException- In case of a range overflow.NumberFormatException- If a given string cannot be parsed as a long.
-
toLongVH
Cast the given value to long and wrap it into a value holder.- See Also:
-
toLong
Cast the given value to long.- Parameters:
p_value- The long value.p_lngFallback- The fallback value ifp_valueisnull.- Returns:
- The long value.
- See Also:
-
toLongVH
Cast the given value to long and wrap it into a value holder.- See Also:
-
toFloat
Cast the given value to float.Note: Prefer double over float where possible.
Valid input types are
java.lang.Number,java.lang.Boolean, value holders, or strings (seeFloat.valueOf(String)).- Parameters:
p_value- The value to be cast.- Returns:
- The float value.
- Throws:
ArithmeticException- In case of a range overflow.NumberFormatException- If a given string cannot be parsed as a float.
-
toFloat
Cast the given value to float.Note: Prefer double over float where possible.
- Parameters:
p_value- The float value.p_fltFallback- The fallback value ifp_valueisnull.- Returns:
- The float value.
- See Also:
-
toDoubleVH
Cast the given value to double and wrap it into a value holder.- See Also:
-
toDouble
Cast the given value to double.Valid input types are
java.lang.Number,java.lang.Boolean, value holders, or strings (seeDouble.valueOf(String)).- Parameters:
p_value- The value to be cast.- Returns:
- The double value.
- Throws:
ArithmeticException- In case of a range overflow.NumberFormatException- If a given string cannot be parsed as a double.
-
toDouble
Cast the given value to double.- Parameters:
p_value- The double value.p_dblFallback- The fallback value ifp_valueisnull.- Returns:
- The double value.
- See Also:
-
toDoubleVH
Cast the given value to double and wrap it into a value holder.- See Also:
-
toBigDecimal
Cast the given value to big decimal.Valid input types are
java.lang.Number,java.lang.Boolean, value holders, or strings.- Parameters:
p_value- The value to be cast.- Returns:
- The big decimal value.
- Throws:
ArithmeticException- In case of a range overflow.NumberFormatException- If a given string cannot be parsed as a big decimal.
-
toBigDecimal
Cast the given value to big decimal.- Parameters:
p_value- The big decimal value.p_lngFallback- The fallback value ifp_valueisnull.- Returns:
- The big decimal value.
- See Also:
-
abs
public int abs(int p_iX) 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.- Parameters:
p_iX- The argument whose absolute value is to be determined.- Returns:
- The absolute value.
-
abs
public long abs(long p_lX) Returns the absolute value of a long value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.- Parameters:
p_lX- The argument whose absolute value is to be determined.- Returns:
- The absolute value.
-
abs
public float abs(float p_fltX) 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.- Parameters:
p_fltX- The argument whose absolute value is to be determined.- Returns:
- The absolute value.
-
abs
public double abs(double p_dblX) 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.- Parameters:
p_dblX- The argument whose absolute value is to be determined.- Returns:
- The absolute value.
-
signum
Returns the signum function of the argument.- Parameters:
p_num- The argument.- Returns:
- Zero if the argument is zero,
1if the argument is greater than zero,-1if the argument is less than zero. - Throws:
ArithmeticException- If the given value isNaN, or not finite.
-
ceil
public double ceil(double p_dbl) Returns the smallest double value that is greater than or equal to the argument and is equal to a mathematical integer. Special cases:- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
- If the argument value is less than zero but greater than -1.0, then the result is negative zero.
- Parameters:
p_dbl- The value.- Returns:
- The smallest (closest to negative infinity) floating-point value that is greater than or equal to the argument and is equal to a mathematical integer. .
-
floor
public double floor(double p_dbl) Returns the largest double value that is less than or equal to the argument and is equal to a mathematical integer. Special cases:- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
- Parameters:
p_dbl- The value.- Returns:
- The largest (closest to positive infinity) floating-point value that less than or equal to the argument and is equal to a mathematical integer.
-
roundHalfUp
public double roundHalfUp(double p_dbl) Returns the closest integer to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result. In other words, the result is equal to the value of the expression:floor(p_dblX + 0.5d)
Examples:roundHalfUp(0) -> 0.0 roundHalfUp(0.5) -> 1.0 roundHalfUp(-0.5) -> 0.0 roundHalfUp(1) -> 1.0 roundHalfUp(-1) -> -1.0
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite.
-
roundHalfUpAsLong
public long roundHalfUpAsLong(double p_dbl) Returns the closestlongto the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to typelong. In other words, the result is equal to the value of the expression:(long)floor(p_dblX + 0.5d)
Examples:roundHalfUp(0) -> 0 roundHalfUp(0.5) -> 1 roundHalfUp(-0.5) -> 0 roundHalfUp(1) -> 1 roundHalfUp(-1) -> -1
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or less thanLong.MIN_VALUE, or greater thenLong.MAX_VALUE.
-
roundHalfUpAsInt
public int roundHalfUpAsInt(double p_dbl) Returns the closestintto the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to typeint. In other words, the result is equal to the value of the expression:(long)floor(p_dblX + 0.5d)
Examples:roundHalfUp(0) -> 0 roundHalfUp(0.5) -> 1 roundHalfUp(-0.5) -> 0 roundHalfUp(1) -> 1 roundHalfUp(-1) -> -1
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite, or less thanInteger.MIN_VALUE, or greater thenInteger.MAX_VALUE.
-
roundHalfAwayFromZero
public double roundHalfAwayFromZero(double p_dbl) Returns the closest integer to the argument. Negative half values are rounded to the lower value.Examples:
roundHalfAwayFromZero(0) -> 0.0 roundHalfAwayFromZero(0.5) -> 1.0 roundHalfAwayFromZero(-0.5) -> -1.0 roundHalfAwayFromZero(1) -> 1.0 roundHalfAwayFromZero(-1) -> -1.0
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite.
-
roundHalfAwayFromZeroAsLong
public long roundHalfAwayFromZeroAsLong(double p_dbl) Returns the closestlongto the argument. Negative half values are rounded to the lower value.Examples:
roundHalfAwayFromZero(0) -> 0 roundHalfAwayFromZero(0.5) -> 1 roundHalfAwayFromZero(-0.5) -> -1 roundHalfAwayFromZero(1) -> 1 roundHalfAwayFromZero(-1) -> -1
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite, or less thanLong.MIN_VALUE, or greater thenLong.MAX_VALUE.
-
roundHalfAwayFromZeroAsInt
public int roundHalfAwayFromZeroAsInt(double p_dbl) Returns the closestintto the argument. Negative half values are rounded to the lower value.Examples:
roundHalfAwayFromZero(0) -> 0 roundHalfAwayFromZero(0.5) -> 1 roundHalfAwayFromZero(-0.5) -> -1 roundHalfAwayFromZero(1) -> 1 roundHalfAwayFromZero(-1) -> -1
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite, or less thanInteger.MIN_VALUE, or greater thenInteger.MAX_VALUE.
-
roundHalfAwayFromZero
public double roundHalfAwayFromZero(double p_dbl, int p_iPrecision) Returns the closest scaled integer to the argument. Negative half values are rounded to the lower value.Examples:
roundHalfAwayFromZero(0.0, 2) -> 0.0 roundHalfAwayFromZero(1.0, 2) -> 1.0 roundHalfAwayFromZero(-1.0, 2) -> -1.0 roundHalfAwayFromZero(1.255, 2) -> 1.26 roundHalfAwayFromZero(-1.255, 2) -> -1.26 roundHalfAwayFromZero(123.5, -2) -> 100.0 roundHalfAwayFromZero(-123.5, -2) -> -100.0
- Parameters:
p_dbl- The value to be rounded.p_iPrecision- The precision (may be a negative value).- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite.
-
roundHalfAwayFromZero
Returns the closest integer to the argument. Negative half values are rounded to the lower value.Examples:
roundHalfAwayFromZero(0) -> 0.0 roundHalfAwayFromZero(0.5) -> 1.0 roundHalfAwayFromZero(-0.5) -> -1.0 roundHalfAwayFromZero(1) -> 1.0 roundHalfAwayFromZero(-1) -> -1.0
- Parameters:
p_bd- The value to be rounded.- Returns:
- The rounded value.
-
roundHalfAwayFromZero
Returns the closest scaled integer to the argument. Negative half values are rounded to the lower value.Examples:
roundHalfAwayFromZero(0.0, 2) -> 0.0 roundHalfAwayFromZero(1.0, 2) -> 1.0 roundHalfAwayFromZero(-1.0, 2) -> -1.0 roundHalfAwayFromZero(1.255, 2) -> 1.26 roundHalfAwayFromZero(-1.255, 2) -> -1.26 roundHalfAwayFromZero(123.5, -2) -> 100.0 roundHalfAwayFromZero(-123.5, -2) -> -100.0
- Parameters:
p_bd- The value to be rounded.p_iPrecision- The precision (may be a negative value).- Returns:
- The rounded value.
-
roundHalfEven
public double roundHalfEven(double p_dbl) Returns the closest integer to the argument. Half values are rounded to the neares even integer.Examples:
roundHalfEven(0) -> 0.0 roundHalfEven(1) -> 1.0 roundHalfEven(-1) -> -1.0 roundHalfEven(0.5) -> 0.0 roundHalfEven(-0.5) -> 0.0 roundHalfEven(1.5) -> 2.0 roundHalfEven(-1.5) -> -2.0 roundHalfEven(0.12) -> 0.0 roundHalfEven(-0.12) -> 0.0 roundHalfEven(0.62) -> 1.0 roundHalfEven(-0.62) -> -1.0
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite.
-
roundHalfEvenAsLong
public long roundHalfEvenAsLong(double p_dbl) Returns the closest integer to the argument. Half values are rounded to the neares even integer.Examples:
roundHalfEven(0) -> 0 roundHalfEven(1) -> 1 roundHalfEven(-1) -> -1 roundHalfEven(0.5) -> 0 roundHalfEven(-0.5) -> 0 roundHalfEven(1.5) -> 2 roundHalfEven(-1.5) -> -2 roundHalfEven(0.12) -> 0 roundHalfEven(-0.12) -> 0 roundHalfEven(0.62) -> 1 roundHalfEven(-0.62) -> -1
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite, or less thanLong.MIN_VALUE, or greater thenLong.MAX_VALUE.
-
roundHalfEvenAsInt
public int roundHalfEvenAsInt(double p_dbl) Returns the closest integer to the argument. Half values are rounded to the neares even integer.Examples:
roundHalfEven(0) -> 0 roundHalfEven(1) -> 1 roundHalfEven(-1) -> -1 roundHalfEven(0.5) -> 0 roundHalfEven(-0.5) -> 0 roundHalfEven(1.5) -> 2 roundHalfEven(-1.5) -> -2 roundHalfEven(0.12) -> 0 roundHalfEven(-0.12) -> 0 roundHalfEven(0.62) -> 1 roundHalfEven(-0.62) -> -1
- Parameters:
p_dbl- The value to be rounded.- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite, or less thanInteger.MIN_VALUE, or greater thenInteger.MAX_VALUE.
-
roundHalfEven
public double roundHalfEven(double p_dbl, int p_iPrecision) Returns the closest integer to the argument. Half values are rounded to the neares even integer.Examples:
roundHalfEven(0, 2) -> 0.0 roundHalfEven(1, 2) -> 1.0 roundHalfEven(-1, 2) -> -1.0 roundHalfEven(1.245, 2) -> 1.24 roundHalfEven(1.255, 2) -> 1.26 roundHalfEven(125.5, -2) -> 100.0 roundHalfEven(150, -2) -> 200.0
- Parameters:
p_dbl- The value to be rounded.p_iPrecision- The precision (may be a negative value).- Returns:
- The rounded value.
- Throws:
ArithmeticException- If the given value isNaN, or not finite.
-
roundHalfEven
Returns the closest integer to the argument. Half values are rounded to the neares even integer.Examples:
roundHalfEven(0) -> 0.0 roundHalfEven(1) -> 1.0 roundHalfEven(-1) -> -1.0 roundHalfEven(0.5) -> 0.0 roundHalfEven(-0.5) -> 0.0 roundHalfEven(1.5) -> 2.0 roundHalfEven(-1.5) -> -2.0 roundHalfEven(0.12) -> 0.0 roundHalfEven(-0.12) -> 0.0 roundHalfEven(0.62) -> 1.0 roundHalfEven(-0.62) -> -1.0
- Parameters:
p_bd- The value to be rounded.- Returns:
- The rounded value.
-
roundHalfEven
Returns the closest scaled integer to the argument. Half values are rounded to the neares even scaled integer.Examples:
roundHalfEven(0, 2) -> 0.0 roundHalfEven(1, 2) -> 1.0 roundHalfEven(-1, 2) -> -1.0 roundHalfEven(1.245, 2) -> 1.24 roundHalfEven(1.255, 2) -> 1.26 roundHalfEven(125.5, -2) -> 100.0 roundHalfEven(150, -2) -> 200.0
- Parameters:
p_bd- The value to be rounded.p_iPrecision- The precision (may be a negative value).- Returns:
- The rounded value.
-
add
Adds two numbers. This method does not check for range overflows.- Parameters:
p_numL- The first addend.p_numR- The second addend.- Returns:
- The sum of the two values.
- Throws:
IllegalArgumentException- If either of the parameters isnull.
-
sub
Subtract two numbers. This method does not check for range overflows.- Parameters:
p_numL- The minuend.p_numR- The subtrahend.- Returns:
- The difference of the two values.
- Throws:
IllegalArgumentException- If either of the parameters isnull.
-
mult
Multiplies two numbers. This method does not check for range overflows.- Parameters:
p_numL- The first factor.p_numR- The second factor.- Returns:
- The product of the two factors.
- Throws:
IllegalArgumentException- If either of the parameters isnull.
-
div
Divides one number by another. This method does not check for range overflows.- Parameters:
p_numL- The dividend.p_numR- The divisor.- Returns:
- The quotient, or
Double.POSITIVE_INFINITYorDouble.NEGATIVE_INFINITYif the divisor is0. - Throws:
IllegalArgumentException- If either of the parameters isnull.
-
idiv
Divides theintpart of first number by theintpart of the second.p_numA.intValue() / p_numB.intValue()This method does not check for range overflows.
- Parameters:
p_numL- The dividend.p_numR- The divisor.- Returns:
- The quotient.
- Throws:
IllegalArgumentException- If either of the parameters isnull.- Since:
- Intrexx 5.2.
-
ldiv
Divides thelongpart of first number by thelongpart of the second.p_numA.longValue() / p_numB.longValue()This method does not check for range overflows.
- Parameters:
p_numL- The dividend.p_numR- The divisor.- Returns:
- The quotient.
- Throws:
IllegalArgumentException- If either of the parameters isnull.- Since:
- Intrexx 5.2.
-
imod
Calculates theintpart of first number modulo theintpart of the second.p_numA.intValue() % p_numB.intValue()This method does not check for range overflows.
- Parameters:
p_numL- The dividend.p_numR- The divisor.- Returns:
- The remainder modulo
p_numB. - Throws:
IllegalArgumentException- If either of the parameters isnull.- Since:
- Intrexx 5.2.
-
lmod
Calculates thelongpart of first number modulo thelongpart of the second.p_numA.intValue() % p_numB.intValue()This method does not check for range overflows.
- Parameters:
p_numL- The dividend.p_numR- The divisor.- Returns:
- The remainder modulo
p_numB. - Throws:
IllegalArgumentException- If either of the parameters isnull.- Since:
- Intrexx 5.2.
-
log
Returns the natural logarithm (base e) of the given number as adouble.- Parameters:
p_num- The numerus.- Returns:
- The natural logarithm ln
p_num. - Throws:
IllegalArgumentException- If either of the parameters isnull.
-
log10
Returns the logarithm to base10of the given number as adouble.- Parameters:
p_num- The numerus.- Returns:
- The logarithm log10
p_num. - Throws:
IllegalArgumentException- If either of the parameters isnull.
-
exp
Returns Euler's number e raised to given power as adouble.- Parameters:
p_numExponent- The exponent.- Returns:
- The value e
p_numExponent. - Throws:
IllegalArgumentException- If the given value isnull.
-
pow
Returns the value of the first argument raised to the power of the second argument as adouble. This method does not check for range overflows.- Parameters:
p_numBase- The first factor.p_numExponent- The second factor.- Returns:
- The value
p_numBasep_numExponent. - Throws:
IllegalArgumentException- If either of the parameters isnull.
-
getPI
public double getPI()Get the value of π, i.e.3.141592653589793.- Returns:
- The value of π
- Since:
- Intrexx 6.0.
-
rad2deg
Convert radians to degrees.deg = 180 / π * rad
- Parameters:
p_num- The angle, in radians.- Returns:
- The degree value of the given radian value.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
deg2rad
Convert degrees to radians.rad = π / 180 * deg
- Returns:
- The radian value of the given degree value.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
ratio2rad
Convert a ratio to radians.rad = 2 * π * nom / denom
- Parameters:
p_numNum- The numerator, e.g. the arc length.p_numDenom- The denominator, e.g. the full circle.- Returns:
- The radian value that corresponds to the given ratio.
- Throws:
IllegalArgumentException- If one of the given values isnull, or if the denominator is0.- Since:
- Intrexx 6.0.
-
sin
Get the trigonometric sine of the given angle.- Parameters:
p_num- The angle, in radians.- Returns:
- The trigonometric sine of the given angle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
sinDeg
Get the trigonometric sine of the given angle.- Parameters:
p_num- The angle, in degrees.- Returns:
- The trigonometric sine of the given angle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
cos
Get the trigonometric cosine of the given angle.- Parameters:
p_num- The angle, in radians.- Returns:
- The trigonometric cosine of the given angle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
cosDeg
Get the trigonometric cosine of the given angle.- Parameters:
p_num- The angle, in degrees.- Returns:
- The trigonometric cosine of the given angle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
tan
Get the trigonometric tangent of the given angle.- Parameters:
p_num- The angle, in radians.- Returns:
- The trigonometric tangent of the given angle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
tanDeg
Get the trigonometric tangent of the given angle.- Parameters:
p_num- The angle, in degrees.- Returns:
- The trigonometric tangent of the given angle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
circleX
Calculate the x-coordinate of a point on a ellipse.circleX(x, r, φ) := x + r * cos(φ)
- Parameters:
p_numX- An x offset.p_numRadius- The radius.p_numAngle- The angle, in radians.- Returns:
- The x-coordinate of a point on the circle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
circleXInt
Calculate the x-coordinate of a point on a ellipse.circleX(x, r, φ) := x + r * cos(φ)
- Parameters:
p_numX- An x offset.p_numRadius- The radius.p_numAngle- The angle, in radians.- Returns:
- The x-coordinate of a point on the circle, rounded to the closest integer.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
circleX
Calculate the x-coordinate of a point on a ellipse.circleX(x, r, p, q) := x + r * cos(2 * π * p / q)
- Parameters:
p_numX- An x offset.p_numRadius- The radius.p_numNum- The numerator, e.g. the arc length.p_numDenom- The denominator, e.g. the full circle.- Returns:
- The x-coordinate of a point on the circle.
- Throws:
IllegalArgumentException- If one of the given values isnull, or if the denominator is0.- Since:
- Intrexx 6.0.
-
circleXInt
Calculate the x-coordinate of a point on a ellipse.circleX(x, r, p, q) := x + r * cos(2 * π * p / q)
- Parameters:
p_numX- An x offset.p_numRadius- The radius.p_numNum- The numerator, e.g. the arc length.p_numDenom- The denominator, e.g. the full circle.- Returns:
- The x-coordinate of a point on the circle, rounded to the closest integer.
- Throws:
IllegalArgumentException- If one of the given values isnull, or if the denominator is0.- Since:
- Intrexx 6.0.
-
circleY
Calculate the y-coordinate of a point on a ellipse.circleY(y, r, φ) := y + r * sin(φ)
- Parameters:
p_numY- An y offset.p_numRadius- The radius.p_numAngle- The angle, in radians.- Returns:
- The y-coordinate of a point on the circle.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
circleYInt
Calculate the y-coordinate of a point on a ellipse.circleY(y, r, φ) := y + r * sin(φ)
- Parameters:
p_numY- An y offset.p_numRadius- The radius.p_numAngle- The angle, in radians.- Returns:
- The y-coordinate of a point on the circle, rounded to the closest integer.
- Throws:
IllegalArgumentException- If the given value isnull.- Since:
- Intrexx 6.0.
-
circleY
Calculate the y-coordinate of a point on a ellipse.circleY(y, r, p, q) := y + r * sin(2 * π * p / q)
- Parameters:
p_numY- An y offset.p_numRadius- The radius.p_numNum- The numerator, e.g. the arc length.p_numDenom- The denominator, e.g. the full circle.- Returns:
- The y-coordinate of a point on the circle.
- Throws:
IllegalArgumentException- If one of the given values isnull, or if the denominator is0.- Since:
- Intrexx 6.0.
-
circleYInt
Calculate the y-coordinate of a point on a ellipse.circleY(y, r, p, q) := y + r * sin(2 * π * p / q)
- Parameters:
p_numRadius- The radius.p_numNum- The numerator, e.g. the arc length.p_numDenom- The denominator, e.g. the full circle.- Returns:
- The y-coordinate of a point on the circle, rounded to the closest integer.
- Throws:
IllegalArgumentException- If one of the given values isnull, or if the denominator is0.- Since:
- Intrexx 6.0.
-
isNaN
public boolean isNaN(float p_flt) Check if the specified number is a Not-a-Number (NaN) value.- Parameters:
p_flt- The number to check.- Returns:
trueif the specified number is a Not-a-Number (NaN) value, orfalseotherwise.
-
isInfinite
public boolean isInfinite(float p_flt) Check if the specified number is infinitely large in magnitude.- Parameters:
p_flt- The number to check.- Returns:
trueif the specified number is infinitely large in magnitude, orfalseotherwise.
-
isNaN
public boolean isNaN(double p_dbl) Check if the specified number is a Not-a-Number (NaN) value.- Parameters:
p_dbl- The number to check.- Returns:
trueif the specified number is a Not-a-Number (NaN) value, orfalseotherwise.
-
isInfinite
public boolean isInfinite(double p_dbl) Check if the specified number is infinitely large in magnitude.- Parameters:
p_dbl- The number to check.- Returns:
trueif the specified number is infinitely large in magnitude, orfalseotherwise.
-
min
Determine the minimum of the given numbers.- Parameters:
p_num1- The first number.p_num2- The second number.- Returns:
- The minimum of the two given numbers.
-
max
Determine the maximum of the given numbers.- Parameters:
p_num1- The first number.p_num2- The second number.- Returns:
- The maximum of the two given numbers.
-
gt
Determine if the first number is greater than the second number.- Parameters:
p_numL- The first number.p_numR- The second number.- Returns:
trueif the first number is greater than the second number, orfalseotherwise.
-
ge
Determine if the first number is greater or equal as the second number.- Parameters:
p_numL- The first number.p_numR- The second number.- Returns:
trueif the first number is greater or equal as the second number, orfalseotherwise.
-
lt
Determine if the first number is less than the second number.- Parameters:
p_numL- The first number.p_numR- The second number.- Returns:
trueif the first number is less than the second number, orfalseotherwise.
-
le
Determine if the first number is less or equal the second number.- Parameters:
p_numL- The first number.p_numR- The second number.- Returns:
trueif the first number is less or equal the second number, orfalseotherwise.
-
getRandomInt
public int getRandomInt(int p_iMinValue, int p_iMaxValue) - Parameters:
p_iMinValue- The inclusive minimum value.p_iMaxValue- The exclusive maximum value.- Returns:
- An integer random number
rfrom the rangep_iMinValue <= r < p_iMaxValue. - Throws:
IllegalArgumentException- - Ifp_iMaxValue < p_iMinValue.
-
getRandomLong
public long getRandomLong(long p_lMinValue, long p_lMaxValue) - Parameters:
p_lMinValue- The inclusive minimum value.p_lMaxValue- The exclusive maximum value.- Returns:
- An integer random number
rfrom the rangep_lMinValue <= r < p_lMaxValue. - Throws:
IllegalArgumentException- - Ifp_lMaxValue < p_lMinValue.
-