What's the difference between ceil and round | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the difference between ceil and round

25th Aug 2020, 10:39 AM
Roy
Roy - avatar
3 Answers
+ 6
In simple words, ceil() will always return nearest higher integer. round() will return nearest higher or lower integer.
25th Aug 2020, 2:02 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Just adding : round results to less than or equal of 0.5 to 0.0 and greater than 0.5 to 1.0 for any decimal point position... Where as ceil result both to 1.0 Ex : round(0.4) =>0.0 ; ceil(0.4) => 1.0 round(0.7) =>1.0 ; ceil(0.7) => 1.0
25th Aug 2020, 11:29 AM
Jayakrishna 🇮🇳
0
cool
27th Aug 2020, 9:10 AM
Demetri Robles
Demetri Robles - avatar