util.Math methods

util.Math class provides a set of basic mathematical functions based on floating point numbers.

These methods are applied to the currently run application and do not need to be instantiated.

util.Math class is one of Lycia build-in classes. You don't need to import any additional packages to make them work.

Available methods

util.Math.sin()

calculates the sine of a passed value, measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.cos()

calculates the cosine of a passed value, measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.tan()

calculates the tangent of a passed value, measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.asin()

calculates the arc sine of a passed value, measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.acos()

calculates the arc cosine of a passed value, measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.atan()

calculates the arc tangent of a passed value, measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.exp()

calculates the base-e exponential of a value passed as a parameter.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.log()

calculates the natural logarithm of a passed value.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.pi()

returns the FLOAT value of π (= the pi number).

Returns FLOAT.

util.Math.pow()

calculates the value of x raised to the power y.

Takes 2 variables of the FLOAT data type as parameters:

CALL util.Math.pow(x, y)

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

If x is negative, make sure that y is an integer value.

util.Math.rand()

returns a positive pseudo-random number between 0 (zero) and the INTEGER value passed as the parameter.

util.Math.srand()

initializes the pseudo-random numbers generator.

util.Math.srand() must be called before the subsequent calls to util.Math.rand(). If not, util.Math.rand() will generate the same sequence of numbers at every execution of the program.

util.Math.sqrt()

returns the square root of an argument provided.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid and NULL if the parameter is invalid.

util.Math.toRadians()

converts an angle measured in degrees to an approximately equivalent angle measured in radians.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid.

util.Math.toDegrees()

converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Takes FLOAT as a parameter.

Returns FLOAT if the parameter is valid.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.