O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

int — Truncate a floating-point value to an integer

Usage

Float.int(num)

num : Floating point

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required