Math


The arguments of the trigonometric functions sin, cos, tan, sinh, cosh, and tanh should be expressed in radians; the results of asin, acos, atan, and atan2 are expressed in radians. One radian is equivalent to 180/pi degrees, or approximately 57.296; to convert from degrees to radians, divide the number of degrees by 57.296. To convert from radians to degrees, multiply by this value.

Function arguments in radians can be given in the range 0 to 2pi, or -pi to pi: for example (5/4)pi and (-3/4)pi are the same. Function results in radians are always returned in the range -pi to pi: for example the angle equal to 225 degrees will always be returned as (-3/4)pi radians (-2.356) rather than (5/4)pi.

Note: The cotangent, secant, and cosecant values are the reciprocals of the tangent, cosine, and sine respectively.

See the user annotation at the bottom of theis page for radian and degree conversion functions.

Name -- Syntax / Description
abs
abs( number )
Returns the absolute value of number.
Returns the absolute value of number.
acos
acos( number )
Returns the arccosine of number. The results are returned in radians.
Returns the results in radians.
asin
asin( number )
Returns the arcsine of number. The results are returned in radians.
Returns the reaults in radians.
atan
atan( number )
Returns the arctangent of number. The results are returned in radians.
Returns the results in radians.
atan2
atan2( x, y )
Returns the arctangent of y/x. This is similar to atan(), but the signs of y and x are taken into account when computing the quadrant of the result. The results are returned in radians.
Returns the results in radians.
ceil
ceil( number )
Returns the smallest integer greater than or equal to number
Returns the results as an integer.
cos
cos( number )
Returns the cosine of number. The argument should be expressed in radians.
Returns the results in radians.
cosh
cosh( number )
Returns the hyperbolic cosine of number. The argument should be expressed in radians.
Returns the hyperbolic cosine.
exp
exp( number )
Returns the constant e (approximately 2.71828) Raised to the power number.
floor
floor( number )
Returns the largest integer less than or equal to number
fmod
fmod( x, y )
Returns the remainder of number1/number2; number1, number2, and the result are all floating point numbers.
int
int( number )
Returns integer portion of number (removes the decimal and any digits to the right of it)
log
log( number )
Returns the natural logarithm (base e, approximately 2.71828) of number.
log10
log10( number )
Returns the base 10 logarithm of number
power
power( number, matissa )
Raises number to a a power (for example, power(12,2)=144)
random
random( max )
Returns a random number less than or equal to maximum
rnd
rnd( value, precision )
Works like the ROUND operator, rounding number up or down to number_of_places after the decimal
sin
sin( number )
Returns the sine of number. The argument should be expressed in radians.
sinh
sinh( number )
Returns the hyperbolic sine of number. The argument should be expressed in radians.
sqrt
sqrt( number )
Returns the square root of number.
srandom
srandom( seed )
Allows a script to reseed the random number generator used by random()
tan
tan( number )
Returns the tangent of number. The argument should be expressed in radians.
tanh
tanh( number )
Returns the hyperbolic tangent of number. The argument should be expressed in radians.
User Annotations: math
Ray Yates : mivascript at, pcinet d0t com
02/09/2012 12:35 a.m.
Convert degree to radian. Equivalent to the PHP function deg2rad(x)
<MvFUNCTION NAME = "degree" PARAMETERS = "radian" STANDARDOUTPUTLEVEL = "">
    <MvFUNCTIONRETURN VALUE = "{ l.radian * 180 / 3.141592653589793116 }">
</MvFUNCTION>
Ray Yates : mivascript at, pcinet d0t com
02/09/2012 12:34 a.m.
Convert radian to degree. Equivalent to the PHP function rad2deg(x)
<MvFUNCTION NAME = "radian" PARAMETERS = "degree" STANDARDOUTPUTLEVEL = "">
    <MvFUNCTIONRETURN VALUE = "{ l.degree * 3.141592653589793116 / 180 }">
</MvFUNCTION>