floor()
Published Oct 14, 2023
Contribute to Docs
The floor()
function takes a value and returns the nearest integer that is lower than or equal to the value given.
The result returns a value type of float
.
Syntax
import kotlin.math.*
floor(x)
Where x
is the number of type double to be rounded down to the nearest integer.
Example
The following example demonstrates a basic implementation of the floor()
method.
import kotlin.math.*println(floor(3.4))
This will output:
3.0
The result will be a float value of 3
as the function rounds 3.4
down to 3
.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.