+ 1

Plz explain why a negative value inside a floor acts like ceiling and vice versa

Example.. System.out.print(Math.floor(3.6)); -->3 System.out.print(Math.floor(-3.6)); -->-4 //why not -3?

28th Oct 2019, 4:02 AM
Sanzid Sadman
Sanzid Sadman - avatar
2 Réponses
+ 10
Math.floor rounds the number you chose to the lower full number. It is 3 because 3 < 3.6 It is -4 because -4 < -3.6
28th Oct 2019, 4:21 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar