Math.floor() (Function)

The value is rounded down to the next integer.

Availability:

ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape Navigator - 2.0
Netscape Enterprise Server version - 2.0
Opera - 3.0
Property/method value type:Number primitive
JavaScript syntax:-Math.floor(aValue)
Argument list:aValueA meaningful numeric value

Returns the greatest number value that is not greater than the argument and is equal to a mathematical integer. If the argument is already an integer, the argument itself is returned.

Special boundary conditions that affect the results are:

ArgumentResult
+infinity+infinity
-infinity-infinity
00
0 < argument > 10
NaNNaN

Note that if the value is negative, the magnitude increases while it decreases for positive numbers. The floor of 25.4 is 25 whereas the floor of -25.4 is -26.

The result is the input value value rounded down to the next integer.

Warnings:

See also:Integer, Integer arithmetic, Integer-value-remainder, Math object, Math.abs(), Math.ceil(), Math.round(), Number(), Remainder (%), Remainder then assign (%=), Type conversion

Cross-references:

ECMA 262 edition 2 - section - 15.8.2.9

ECMA 262 edition 3 - section - 15.8.2.9