The pnuts.math module defines functions for the basic numeric operations which are defined in java.lang.Math class. See API document for more detail.
Returns the trigonometric sine of an angle.
Returns the trigonometric cosine of an angle.
Returns the trigonometric tangent of an angle.
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
Returns the arc cosine of an angle, in the range of 0.0 through pi.
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
Converts rectangular coordinates (x, y)
to polar (r, theta).
This method computes the phase theta by computing an arc tangent
of y/x in the range of -pi to pi.
Converts an angle measured in degrees to an approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact.
Converts an angle measured in radians to an approximately
equivalent angle measured in degrees. The conversion from
radians to degrees is generally inexact; users should
not expect cos(toRadians(90.0)) to exactly
equal 0.0.
Returns Euler's number e raised to the power of a
double value.
Returns the natural logarithm (base e) of a double
value.
Returns the correctly rounded positive square root of a
double value.
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.
Returns the smallest (closest to negative infinity)
double value that is greater than or equal to the
argument and is equal to a mathematical integer.
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.
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.
Returns the value of the first argument raised to the power of the second argument.
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:
floor(a + 0.5)
Returns the absolute value of the specified number. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.
Returns the greater of two numbers.
If a Collection object or an array is specified as the 1st argument, this function returns the maximum element of the Collection/Array object. The optional 2nd argument is used for comparing the elements.
max([1,2,-6,4], abs) -> -6
Returns the smaller of two numbers.
If a Collection object or an array is specified as the 1st argument, this function returns the minimum element of the Collection/Array object. The optional 2nd argument is used for comparing the elements.
min([1,2,-6,4], abs) -> 1