floor

 
 
 

Returns a number rounded to the largest integer less than or equal to a floating point number.

float floor(float number)

number is the number you want to round.

Examples

floor(2.344)

Returns 2.

floor(3.0)

Returns 3.

floor(Head.height)

If Head.height is -2.8, this returns -3.

Tip

You can use floor for rounding to the nearest number (for example, rounding 2.75 up to 3 and rounding 2.25 down to 2). Simply create a function that adds 0.5 to the number before using floor; this will get the right results:

floor (2.25 + .5) = 2
floor (2.75 + .5) = 3