Name

Math.ceil( ) Method — round a number up to the next integer

Availability

Flash 5; may be used when exporting Flash 4 movies

Synopsis

Math.ceil(x)

Arguments

x

A number.

Returns

The next integer greater than or equal to x.

Description

The ceil( ) (i.e., ceiling) method converts a floating-point number to the first integer greater than or equal to x.

Example

Math.ceil(1.00001);  // Returns 2
Math.ceil(5.5);      // Returns 6
Math.ceil(-5.5);     // Returns -5

See Also

Math.floor( ), Math.round( )

Get ActionScript: The Definitive Guide 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.