  ## 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.

## 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 