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

Preferences - Do not show ads

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.


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.


Page 55 of 71 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?






WMLScript Tutorial Table of Contents WMLScript Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page