Math methods
Note: each method is preceded with "math", as these methods are static. For instance, math|sin(math.pi). Also, all trigonometric functions express arguments/return results in radians. To convert to radians:
var deg2rad = { args * math.pi / 180; };
and to degrees:
var rad2deg = { args * 180 / math.pi; };
- abs(value): take the absolute value of an integer value
- acos(value): take the arccosine of a value
- asin(value): take the arcsine of a value
- atan(value): take the arctangent of a value
- ceil(value): smallest integer greater than value
- cos(value): cosine of an angle
- cosh(value): hyperbolic cosine of x
- exp(value): returns evalue
- fabs(value): take the absolute value of a floating point number
- floor(value): greatest integer smaller than value.
- fmod(x, y): floating point remainder of x / y.
- frexp(value): returns a list containing the mantissa and the exponent of a floating-point value
- ldexp(x, power): multiplies x by 2power.
- log(x): takes log base e of x.
- log10(x): takes log base 10 of x.
- modf(x): splits x into integer and fractional components and returns a list containing both
- pow(number, power): returns numberpower.
- sin(x): sine of x
- sinh(x): hyperbolic sine of x
- sqrt(x): square root of x. For other roots, you can use math|pow(x, 1 / power), where power is the root you want (i.e. 1/3 = cube root)
- tan(x): tangent of x
- tanh(x): hyperbolic tangent of x
Constants
- pi
- e
