Libraries anvil math

namespace math
Standard set of mathematical operations.

Constants

constant E
The float value that is closer than any other to e, the base of the natural logarithms.

constant MAX_FLOAT
The largest positive finite value the float can contain.

constant MAX_INT
Maximum value that int can hold (2^63).

constant MIN_FLOAT
The smallest negative finite value the float can contain.

constant MIN_INT
Minimum value that int can hold (-2^63).

constant NaN
Not a number, returned by float operations.

constant NEG_INF
The float value of negative infinity.

constant PI
The float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.

constant POS_INF
The float value of positive infinity.


Functions

int abs(int num)
float abs(float num)
Returns the absolute value of given number.

float acos(float a)
Returns the arc cosine of an angle, in the range of -pi/2 through pi/2.

float asin(float a)
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.

float atan(float a)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.

float atan2(float a, float b)
Converts rectangular coordinates (b, a) to polar (r, theta). This method computes the phase theta by computing an arc tangent of a/b in the range of -pi to pi.

float ceil(float num)
Returns the smallest (closest to negative infinity) float value that is not less than the argument and is equal to a mathematical integer.

float cos(float angle)
Returns the trigonometric cosine of an angle.
Parameters angle -  an angle, in radians

float exp(float num)
Returns the exponential number e (i.e., 2.718...) raised to the power of a given value.

float floor(float num)
Returns the largest (closest to positive infinity) float value that is not greater than the argument and is equal to a mathematical integer.

float log(float num)
Returns the natural logarithm (base e) of a float value.

object max(object parameters, ...)
Returns maximum value from parameters.
Returns Maximum value

object min(object parameters, ...)
Returns minimum value from parameters.
Returns Minimum value

float pow(float num, float power)
Returns of value of the first argument raised to the power of the second argument.

int random(int lobound, int hibound)
Returns pseudorandom integer between given range.
Parameters lobound -  Low bound, inclusive
hibound -  High bound, inclusive
Returns Pseudorandom number

float randomFloat()
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0

float randomGaussian()
Returns pseudorandom, Gaussian ("normally") distributed float value with mean 0.0 and standard deviation 1.0.

void randomize(int seed)
Sets the seed of random number generator.

int round(float num)
Returns the closest int to the argument.

int sing(int number)
int sing(float number)
Returns an integer indicating the sign of parameter. -1 for negative, 1 for positive and 0 for zero.

float sin(float angle)
Returns the trigonometric sine of an angle.
Parameters angle -  an angle, in radians

float sqrt(float num)
Returns the square root of a given value.

float tan(float angle)
Returns the trigonometric tangent of an angle.
Parameters angle -  an angle, in radians

float toDegrees(float angle)
Converts an angle measured in radians to the equivalent angle measured in degrees.
Parameters angle -  an angle, in radians

float toRadians(float angle)
Converts an angle measured in degrees to the equivalent angle measured in radians.
Parameters angle -  an angle, in degrees