Math

package lua

Available on lua

Mathematical Functions

Static variables

staticread onlyhuge:Float

The value HUGE_VAL, a value larger than or equal to any other numerical value.

staticread onlypi:Float

The value of pi.

Static methods

staticabs(x:Float):Float

Returns the absolute value of x.

staticacos(x:Float):Float

Returns the arc cosine of x (in radians).

staticasin(x:Float):Float

Returns the arc sine of x (in radians).

staticatan(x:Float):Float

Returns the arc tangent of x (in radians).

staticatan2(y:Float, x:Float):Float

Returns the arc tangent of y/x (in radians), but uses the signs of both parameters to find the quadrant of the result. (It also handles correctly the case of x being zero.)

staticceil(x:Float):Int

Returns the smallest integer larger than or equal to x.

staticcos(x:Float):Float

Returns the cosine of x (assumed to be in radians).

staticcosh(x:Float):Float

Returns the hyperbolic cosine of x.

staticdeg(x:Float):Float

Returns the angle x (given in radians) in degrees.

staticexp(x:Float):Float

Returns the value e^x.

staticfloor(x:Float):Int

Returns the largest integer smaller than or equal to x.

staticfmod(x:Float):Float

Returns the remainder of the division of x by y that rounds the quotient towards zero.

staticfrexp(x:Float):MathFrexpResult

Returns m and e such that x = m2^e, e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).

staticldexp(m:Float, e:Int):Float

Returns m2^e (e should be an integer).

staticlog(x:Float):Float

Returns the natural logarithm of x.

staticlog10(x:Float):Float

Returns the base-10 logarithm of x.

staticmax(x:Float, numbers:Rest<Float>):Float

Returns the maximum value among its arguments.

staticmin(x:Float, numbers:Rest<Float>):Float

Returns the minimum value among its arguments.

staticmodf(x:Float):Float

Returns two numbers, the integral part of x and the fractional part of x.

staticpow(x:Float, y:Float):Float

Returns y-th power of x.

staticrad(x:Float):Float

Returns the angle x (given in degrees) in radians.

staticrandom(?m:Float, ?n:Float):Float

This function is an interface to the simple pseudo-random generator function rand provided by ANSI C. (No guarantees can be given for its statistical properties.)

When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, returns a uniform pseudo-random integer in the range [m, n].

staticrandomseed(x:Float):Float

Sets x as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers.

staticsin(x:Float):Float

Returns the sine of x (assumed to be in radians).

staticsinh(x:Float):Float

Returns the hyperbolic sine of x.

staticsqrt(x:Float):Float

Returns the square root of x.

statictan(x:Float):Float

Returns the tangent of x (assumed to be in radians)

statictanh(x:Float):Float

Returns the hyperbolic tangent of x.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/lua/Math.html