what is Math.floor and Math.ceil in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is Math.floor and Math.ceil in java?

12th Apr 2020, 8:04 AM
Muhammad Asad
Muhammad Asad - avatar
2 Answers
+ 6
well if you ceil a float, it will result in the next integer of that float a d if you floor that it will tesult in the previous integer. for examlpe, suppose you live in the 6th floor of your building and floating in air in your room.😂😂 now, if I ceil you, you will touch the ceiling and your value will be 7 and if I floor you you will come normal with a value of 6.
12th Apr 2020, 8:12 AM
M Tamim
M Tamim - avatar
+ 1
Hi. Those methods do number rounding to integer. Ceil does it upwards, floor does downwards
12th Apr 2020, 8:10 AM
Stephan
Stephan - avatar