Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdriana Alvear
1,538 Pointsquestion about math.ceil
What is the purpose of using math.ceil if you can have the same result with total/number_of_people?
1 Answer
William Li
7,950 Pointsmath.ceil(x) returns the smallest integer greater or equal to x, it is used to round numbers up to the nearest integer value.
It probably gives the same result because (total/number_of_people) equals to a whole number.
if (total/number_of_people) is a decimal value then math.ceil will round it up to the nearest integer
Adriana Alvear
1,538 PointsAdriana Alvear
1,538 Pointsthanks!