abs
calculates absolute value of argument. (V1)
SYNOPSIS
y = math.abs(x)
DESCRIPTION
Calculates absolute value of argument passed
INPUTS
x - argument
RESULT
Absolute value of 'x
acos
calculates arc cosine of argument. (V1)
SYNOPSIS
y = math.acos(x)
DESCRIPTION
Calculates arc cosine of argument passed. The result is always in <-pi/2, +pi/2> range. The result is in radians. For argument outside <-1, +1> range 'NaN' is returned
INPUTS
x - argument
RESULT
Arc cosine of 'x
asin
calculates arc sine of argument. (V1)
SYNOPSIS
y = math.asin(x)
DESCRIPTION
Calculates arc sine of argument passed. The result is always in <-pi/2, +pi/2> range. The result is in radians. For argument outside <-1, +1> range 'NaN' is returned
INPUTS
x - argument
RESULT
Arc sine of 'x
atan
calculates arc tangent of argument. (V1)
SYNOPSIS
y = math.atan(x)
DESCRIPTION
Calculates arc tangent of argument passed. The result is in radians in <-pi/2, +pi/2> range. The function accepts '+Inf' and '-Inf' values, returning +pi/2 and -pi/2 respectively
INPUTS
x - argument
RESULT
Arc tangent of 'x
atan2
calculates four quadrants arc tangent. (V1)
SYNOPSIS
z = math.atan2(y, x)
DESCRIPTION
Calculates a signed angle between the X axis and a vector [x y] in Cartesian 2D coordinate system. Useful for conversion from rectangular to polar coordinates. The result is in radians. Formally it calculates arc tangent of y/x, but it takes signs of x and y to place the result in the proper quadrant of coordinate system. It also handles the case of x being 0, which could trigger a division by 0 exception. x and y may be also +Inf or -Inf. The result is in <-pi, +pi> range
INPUTS
x, y - rectangular coordinates of vector being the second angle arm
RESULT
Angle between the X axis and vector [x y] in radians
SEE ALSO
ceil
round to lowest integral value not lower than argument. (V1)
SYNOPSIS
y = math.ceil(x)
DESCRIPTION
Returns the lowest integer value not lower than the argument. For negative values it means rounding towards zero, for positive values rounding away from zero
INPUTS
x - argument
RESULT
Integer result
cos
calculates cosine of argument. (V1)
SYNOPSIS
y = math.cos(x)
DESCRIPTION
Calculates cosine of argument passed. The argument is in radians
INPUTS
x - argument
RESULT
Cosine of x
cosh
calculates hyperbolic cosine of argument. (V1)
SYNOPSIS
y = math.cosh(x)
DESCRIPTION
Calculates hyperbolic cosine of argument passed
INPUTS
x - argument
RESULT
Hyperbolic cosine of x
deg
converts radians to degrees. (V1)
SYNOPSIS
y = math.deg(x)
DESCRIPTION
Converts an angle in radians into degrees
INPUTS
x - angle in radians
RESULT
Angle in degrees
exp
raises "e" to specified power. (V1)
SYNOPSIS
y = math.exp(x)
DESCRIPTION
Raises "e" (base of natural logarithms) to the power of argument
INPUTS
x - argument
RESULT
e^x
floor
round to highest integral value not higher than argument (V1)
SYNOPSIS
y = math.floor(x)
DESCRIPTION
Returns the highest integer value not higher than the argument. For negative values it means rounding away from zero, for positive values rounding towards zero
INPUTS
x - argument
RESULT
Integer result
fmod
calculates remainder of floating point division. (V1)
SYNOPSIS
z = math.fmod(x, y)
DESCRIPTION
Calculates how many integral times y fits into x, then calculates the remainder of x. In other words it divides x by y, then rounds the quotient v towards zero and calculates remainder as x - y * v. The function returns 'NaN' if x is +-infinity or y is 0
INPUTS
x - dividend. y - divisor
RESULT
Remainder of division
frexp
converts argument into base-two exponent and mantissa. (V1)
SYNOPSIS
m, e = math.frexp(x)
DESCRIPTION
Converts argument into base-two integral exponent e and normalized mantissa m, so x = 2^e * m and absolute value of m belongs to [0.5, 1.0) range. When x is 0, both exponent and mantissa are 0
INPUTS
x - argument
RESULT
e - base-two exponent. m - normalized fraction
SEE ALSO
ldexp
huge
value outside of representable number range. (V1)
SYNOPSIS
math.huge
DESCRIPTION
A positive value outside of representable number range in Lua, equivalent of +Inf. -huge is the equivalent of -Inf. The representable number range in MorphOS is +-1.7976931348623157e+308 (double precision float
ldexp
constructs a number from base-two exponent and mantissa. (V1)
SYNOPSIS
y = math.ldexp(m, e)
DESCRIPTION
Construct a number from base-two exponent and mantissa according to the formula y = 2^e * m. In spite of ldexp() is considered as an inverse function to frexp() it also works for not normalized mantissas
INPUTS
m - mantissa. e - base-two integral exponent
RESULT
2^e * m
SEE ALSO
frexp
log
calculates natural logarithm of argument. (V1)
SYNOPSIS
y = math.log(x)
DESCRIPTION
Calculates natural (of base "e") logarithm of argument passed. If the argument is zero or negative, NaN is returned
INPUTS
x - argument
RESULT
Natural logarithm of x
log10
calculates common (base 10) logarithm of argument. (V1)
SYNOPSIS
y = math.log10(x)
DESCRIPTION
Calculates common (of base 10) logarithm of argument passed. If the argument is zero or negative, 'NaN' is returned
INPUTS
x - argument
RESULT
Base 10 logarithm of x
max
finds highest number in a set. (V1)
SYNOPSIS
y = math.max(x1, ...)
DESCRIPTION
Returns the highest number amongst arguments passed
INPUTS
x1, ... - arguments
RESULT
The highest of arguments
min
finds lowest number in a set. (V1)
SYNOPSIS
y = min(x1, ...)
DESCRIPTION
Returns the lowest number amongst arguments passed
INPUTS
x1, ... - arguments
RESULT
The lowest of arguments
modf
splits argument into integral and fractional part. (V1)
SYNOPSIS
y, z = modf(x)
DESCRIPTION
Splits argument passed into integral part y and fractional part z. Both parts have the same sign as x
INPUTS
x - argument
RESULT
y - integral part of argument. z - fractional part of argument
pi
pi constant. (V1)
SYNOPSIS
math.pi
DESCRIPTION
Pi constant, defined as 3.14159265358979323846
pow
calculates power of two real arguments. (V1)
SYNOPSIS
z = pow(x, y)
DESCRIPTION
Raises x to the power of y. Both arguments may be real numbers, with the exception that negative x allows only for integral y. If x is negative and y is not integral, the result would be a complex number, so NaN value is returned
INPUTS
x - base. y - exponent
RESULT
Base raised to the power of exponent
rad
converts degrees to radians. (V1)
SYNOPSIS
y = math.rad(x)
DESCRIPTION
Converts an angle in degrees into radians
INPUTS
x - angle in degrees
RESULT
Angle in radians
random
pseudorandom number generator. (V1)
SYNOPSIS
y = math.random([upper[, lower]])
DESCRIPTION
Generates pseudorandom number using standard C library generator. This generator has usually a property of generating the same sequence for the same seed. Also its statistic properties may be far from ideal. When called without arguments it returns random real number in [0.0, 1.0] range. With one argument 'upper' it returns an integer in [1, upper] range. With two arguments 'upper' and 'lower' it returns an integer in [lower, upper] range. In all cases the distribution is assumed to be uniform
INPUTS
upper - upper including bound for integer range. lower - lower including bound for integer range
RESULT
Random number
SEE ALSO
randomseed
randomseed
initializes pseudorandom number generator. (V1)
SYNOPSIS
math.randomseed(x)
DESCRIPTION
Initializes pseudorandom number generator with argument given
INPUTS
x - pseudorandom generator seed
RESULT
None
SEE ALSO
random
sin
calculates sine of argument. (V1)
SYNOPSIS
y = math.sin(x)
DESCRIPTION
Calculates sine of argument passed. The argument is in radians
INPUTS
x - input number (angle) in radians
RESULT
Sine of x
sinh
calculates hyperbolic sine of argument. (V1)
SYNOPSIS
y = math.sinh(x)
DESCRIPTION
Calculates hyperbolic sine of argument passed
INPUTS
x - input number (angle) in radians
RESULT
Hyperbolic sine of x
sqrt
calculates square root of argument. (V1)
SYNOPSIS
y = math.sqrt(x)
DESCRIPTION
Calculates square root of argument passed. The function returns 'NaN' if argument is negative
INPUTS
x - argument
RESULT
Square root of x
tan
calculates tangent of argument. (V1)
SYNOPSIS
y = math.tan(x)
DESCRIPTION
Calculates tangent of argument passed. Argument is in radians
INPUTS
x - argument
RESULT
Tangent of x
tanh
calculates hyperbolic tangent of argument. (V1)
SYNOPSIS
y = math.tanh(x)
DESCRIPTION
Calculates hyperbolic tangent of argument passed
INPUTS
x - argument
RESULT
Hyperbolic tangent of x