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


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page