Description
The floor
function returns the value of a given numeric value number
rounded down to the nearest whole number. This means that the value is always rounded down to the smaller whole number.
Syntax
floor(number)
Arguments
Argument | Description |
---|---|
number |
A numeric value to be rounded down to the next smaller whole number. |
Return Type
Returns a whole number that is less than or equal to the given numeric value.
Example
floor(4.7) = 4 floor(-3.2) = -4
Notes
floor
is useful when numbers need to be consistently rounded down in formulas, for example, when calculating costs or other values where decimal places need to be removed.- For negative numbers, it also rounds down, so the resulting value is further away from zero (e.g.,
floor(-2.8)
results in-3
).
Comments
0 comments
Please sign in to leave a comment.