You are here: Math API
Using the Math API, you can provide your app with the ability to perform various mathematical operations on a given set of numbers.
The Math API uses the
math Namespace and the following API elements.
|Returns the maximum value among the given set of numbers.
|Returns the minimum value among the given set of numbers.
|Computes the value of the first parameter raised to the power of the second parameter
|Returns the square root of a given number.
|Generates a real number between 0 and 1.
|Converts a float value to an integer (number before the decimal).
|Returns the value of pi.
Find the largest and the smallest numbers from a given set of numbers, by using the Math.max and the Math.min functions. Compute the square root of a number by using the Math.sqrt function and power of a number using the Math.pow function. To return the value of pi, use the Math.pi function. To generate a random number between 0 and 1, use the Math.random function. Further, you can convert a float value to an integer by using the Math.floor function.
To view the functionality of the Math API in action, download the sample application from the link below. Once the application is downloaded, build and preview the application using the Volt MX App.