Rounds a floating-point number down to the next smaller integer value.
The Float.floor function returns the
next smallest integer (in a negative direction) for a given
floating-point number. If the number is already an integer, then that
same integer value will be returned.
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.floor function returns
invalid.
The similar Float.ceil
function returns the next largest integer.
<?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>
floor
example
</p>
<do type="accept">
<go
href="FloorExample.wmls#findfloor()" />
</do>
</card>
<card id="card2">
<p>
original number = $(number)
<br />
floor
number = $(floornumber)
</p>
</card>
</wml>
Code for FloorExample.wml
extern function findfloor()
{
var mydefault = "71.348";
var result = Dialogs.prompt("Enter any number",
mydefault);
var floornum = Float.floor(result);
WMLBrowser.setVar("number", result);
WMLBrowser.setVar("floornumber",
floornum);
WMLBrowser.go("FloorExample.wml#card2");
};
Code for FloorExample.wmls