18.3. Raising a Numeric Value to the Power of Another Numeric Value: pow() Function
The pow() function is used to raise a numeric value to the power of another numeric value. Its syntax is:
Float.pow(numeric_value1, numeric_value2);
The pow() function returns the result of raising numeric_value1 to the power of numeric_value2, i.e. numeric_value1numeric_value2. If any error occurs, it returns the invalid value.
Note that if numeric_value1 is smaller than zero, numeric_value2 must be an integer. If numeric_value1 is zero, numeric_value2 must be zero or greater than zero.
The following WMLScript example demonstrates how to use the pow() function:
x
= Float.pow(10, 2);
y = Float.pow(10.5, 2.5);
After the execution of the above script, x has the floating-point value 100.0 and y has the floating-point value 357.251.
Previous Page | Page 53 of 71 | Next Page | ![]() |
Contents at a Glance (Click Here for Full Table of Contents)
- 1. WMLScript Introduction
- 2. Hello World WMLScript Example
- 3. Compiling WMLScript Code
- 4. WMLScript Language Rules
- 5. Defining WMLScript Functions
- 6. Calling WMLScript Functions
- 7. WMLScript Variables
- 8. WMLScript Data Types
- 9. WMLScript Variables Vs WML Variables
- 10. Passing Arguments to Functions By Value and By Reference
- 11. WMLScript Operators
- 12. WMLScript Conditional Statements
- 13. WMLScript Looping Statements
- 14. WMLScript Standard Libraries Overview
- 15. WMLScript WMLBrowser Standard Library
- 16. WMLScript Dialogs Standard Library
- 17. WMLScript String Standard Library
- 18. WMLScript Float Standard Library
- 19. WMLScript Lang Standard Library
- 20. WMLScript URL Standard Library
- 21. WMLScript Example: Validating Form Data