FUNCTION:  Float.pow

Float.pow(value, power)
 
The Float.pow function returns the result of raising a given value (number) to a given power.
 
If the browser does not support floating-point arithmetic operations, then the browser will not recognize the Float Library, nor any of the member functions. In this case, the Float.pow function returns invalid.
 
The mandatory value parameter is the value that you want to raise to a power. It can be any positive or negative single-precision floating-point number or any positive or negative integer number, including zero. The floating-point number must occur on or between the largest number and the smallest nonzero number supported by the browser. These boundary values can be determined using the Float.maxFloat and Float.minFloat functions.
 
The mandatory power parameter is the power that you want to raise the value to. It can be any positive or negative single-precision floating-point number or any positive or negative integer number, including zero, but with the following limitation. If the value parameter is a negative number (floating-point or integer), then the power parameter can only be a positive or negative integer (not floating-point). If the power parameter is a floating-point number, it must occur on or between the largest number and the smallest nonzero number supported by the browser. These boundary values can be determined using the Float.maxFloat and Float.minFloat functions.
 
Code for PowExample.wml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   pow example
   </p>
   <do type="accept">
      <go href="PowExample.wmls#findpow()" />
   </do>
</card>

<card id="card2">
<p>
   number = $(number)
   <br />
   power = $(power)
   <br />
   number raised to power = $(numtopow)
</p>
</card>

</wml>

 
Code for PowExample.wmls
extern function findpow()
{
   var defaultvalue = "71.348";
   var num = Dialogs.prompt("Enter any number", defaultvalue);
   var defaultpower = "2";
   var powr = Dialogs.prompt("Enter the power", defaultpower);
   var numpowr = Float.pow(num, powr);
   WMLBrowser.setVar("number", num);
   WMLBrowser.setVar("power", powr);
   WMLBrowser.setVar("numtopow", numpowr);
   WMLBrowser.go("PowExample.wml#card2");
};

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information