Name
int — Truncate a floating-point value to an integer
Usage
Float.int(num)
: Floating pointnum
Description
Returns an integer value formed by ignoring everything after the
decimal point. Returns num
itself if
it’s an integer. Returns invalid
if
num
can’t be converted to floating
point or if the result won’t fit into an integer.
Examples
Float.int(17.0)
returns integer 17
Float.int(17.4)
returns integer 17
Float.int(17.5)
returns integer 17
Float.int(-17.0)
returns integer -17
Float.int(-17.4)
returns integer -17
Float.int(-17.5)
returns integer -17
Float.int(5e10)
returns invalid
Float.int(-5e10)
returns invalid
Float.int("foo")
returns invalid
Get Learning WML, and WMLScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.