How to get the largest integer that is less than or equal to a number (floor) in Groovy

1 Answer

0 votes
double d = -3.7
System.out.println(Math.floor(d))

d = 3.9
System.out.println(Math.floor(d))

d = 3.4
System.out.println(Math.floor(d)) 




/*
run:

-4.0
3.0
3.0

*/

 



answered Oct 3, 2020 by avibootz
edited Oct 4, 2020 by avibootz
...