Compute Floor
Compute the greatest integer value less than or equal to x.
Examples
Filter
console.log(Math.floor(5.95));
// expected output: 5
console.log(Math.floor(5.05));
// expected output: 5
console.log(Math.floor(5));
// expected output: 5
console.log(Math.floor(-5.05));
// expected output: -6
Math.floor( 45.95); // 45
Math.floor( 45.05); // 45
Math.floor( 4 ); // 4
Math.floor(-45.05); // -46
Math.floor(-45.95); // -46
package main
import (
"fmt"
"math"
)
func main() {
c := math.Floor(1.51)
fmt.Printf("%.1f", c)
}