The function returns the integer portion of a given floating-point number. The decimal and all digits to the right of the decimal are simply discarded. 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 function returns invalid.
The mandatory value parameter 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 reside 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 FloorExample.wml
<?xml version="1.0"?>

<card id="card1">
   int example
   <do type="accept">
      <go href="IntExample.wmls#findint()" />

<card id="card2">
   original number = $(number)
   <br />
   integer portion = $(intnumber)


Code for IntExample.wmls
extern function findint()
   var mydefault = "71.348";
   var result = Dialogs.prompt("Enter any number", mydefault);
   var intnum =;
   WMLBrowser.setVar("number", result);
   WMLBrowser.setVar("intnumber", intnum);

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