18.5. Calculating the Ceiling of a Numeric Value: ceil() Function

The ceil() function calculates the ceiling of a numeric value. The ceiling of a numeric value, say Value A, means the smallest integer that is greater than Value A if Value A is a floating-point number, or Value A itself if it is an integer. The following WMLScript example can help you understand what we are talking about:


w = Float.ceil(10.4);
x = Float.ceil(10.5);
y = Float.ceil(-10.5);
z = Float.ceil(10);


After the execution of the above script, w and x have the integral value 11, y has the integral value -10 and z has the integral value 10.


18.6. Calculating the Floor of a Numeric Value: floor() Function

The floor() function calculates the floor of a numeric value. The floor of a numeric value, say Value A, means the largest integer that is smaller than Value A if Value A is a floating-point number, or Value A itself if it is an integer. The following WMLScript example can help you understand what we are talking about:


w = Float.floor(10.4);
x = Float.floor(10.5);
y = Float.floor(-10.5);
z = Float.floor(10);


After the execution of the above script, w and x have the integral value 10, y has the integral value -11 and z has the integral value 10.


Previous Page Page 55 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.