Mathematical functions
The luego.math package contains common mathematical functions.
luego.math
abs
Returns the absolute value of the numeric argument
acos
Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi
acosSafe
Returns the arc cosine of a value wrapped in an option; the returned angle is in the range 0.0 through pi
addVectors
Sum of two vectors of numbers v1 and v2
addVectorsI
Sum of two vectors of integers v1 and v2
approxEq
Approximately equals
approxEqBD
Approximately equals for big decimals
areaOfCircle
Returns the area of a circle of radius r
asin
Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2
asinSafe
Returns the arc sine of a value wrapped in an option; the returned angle is in the range -pi/2 through pi/2
atan
Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2
cbrt
Returns the cube root of a double value
ceil
Returns the smallest (closest to negative infinity) long value that is greater than or equal to the argument
ceilInt
Returns the smallest (closest to negative infinity) integer value that is greater than or equal to the argument
cos
Returns the trigonometric cosine of an angle a
cosh
Returns the hyperbolic cosine of a double value
divideAndRemainder
Returns a tuple containing the integer part of the quotient (x / y) rounded down and the remainder (x % y)
divSafe
Returns the division of two integers wrapped in an option in case the divider is zero
E
The double value that is closer than any other to e, the base of the natural logarithms
exp
Returns Euler's number e raised to the power of a double value
floor
Returns the largest (closest to positive infinity) long value that is less than or equal to the argument
floorDiv
Divides the first parameter by the second one, and then performs a floor operation over the result, returning the Long that is less or equal to the quotient
floorInt
Returns the largest (closest to positive infinity) integer value that is less than or equal to the argument
hypot
Returns sqrt(xx + yy) without intermediate overflow or underflow
IntegerMax
The largest value representable as an Integer
IntegerMin
The smallest value representable as an Integer
log
Returns the natural logarithm (base e) of a double value
log10
Returns the base 10 logarithm of a double value
LongMax
The largest value representable as a Long
LongMin
The smallest value representable as a Long
max
Returns the larger of two numeric values
min
Returns the smaller of two numeric values
NumberMax
The largest value representable as a Double
NumberMin
The smallest value representable as a Double
Pi
The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter
polynomial
Evaluate a polynomial with passed coefficients at x. The array of coefficients must have at least one element.
pow
Returns the value of the first argument raised to the power of the second argument
powBD
Returns the value of the first argument raised to the power of the second argument
random
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0
round
Returns the closest Long to the argument
roundInt
Returns the closest Int to the argument
scale
Returns a new BigDecimal with scale s
scaleAndRounding
Returns a new BigDecimal with scale s and rounding r
signum
Returns the signum of the argument: zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero
sin
Returns the trigonometric sine of an angle a
sinh
Returns the hyperbolic sine of a double value
sqrt
Returns the correctly rounded positive square root of a double value
sqrtSafe
Returns the correctly rounded square root of a double value wrapped in an option
tan
Returns the trigonometric tangent of an angle a
tanh
Returns the hyperbolic tangent of a double value
toDegrees
Converts an angle measured in radians to an approximately equivalent angle measured in degrees
toRadians
Converts an angle measured in degrees to an approximately equivalent angle measured in radians
volumeOfSphere
Returns the volume of a sphere of radius r