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 trial


In the last part "let chairs = width / chairWidth" Why is the answer 3, when it should be 3.33333?

Does Swift round it off?

1 Answer

Gavin Ralston
Gavin Ralston
28,770 Points

"Conversions between integer and floating-point numeric types must be made explicit"

In other words, if you divide integers, they'll stay integers, so the remainder will be truncated. This behavior is common in many languages.

In order to get a floating point answer, you'd need to make the numbers floats or doubles or, maybe apple came up with their own new terminology like "dotted" or "pointy" or something. The docs will help you there.

Thank you very much! That clears it up :)