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 |
- 1. WMLScript Introduction
- 2. Hello World WMLScript Example
- 3. Compiling WMLScript Code
- 4. WMLScript Language Rules
- 5. Defining WMLScript Functions
- 6. Calling WMLScript Functions
- 7. WMLScript Variables
- 8. WMLScript Data Types
- 9. WMLScript Variables Vs WML Variables
- 10. Passing Arguments to Functions By Value and By Reference
- 11. WMLScript Operators
- 12. WMLScript Conditional Statements
- 13. WMLScript Looping Statements
- 14. WMLScript Standard Libraries Overview
- 15. WMLScript WMLBrowser Standard Library
- 16. WMLScript Dialogs Standard Library
- 17. WMLScript String Standard Library
- 18. WMLScript Float Standard Library
- 19. WMLScript Lang Standard Library
- 20. WMLScript URL Standard Library
- 21. WMLScript Example: Validating Form Data