Ruby has a few different data types for working with numbers. Two of the primary options are integer and float. In this section, we're going to walk through the difference between the two data types and how they can affect your program. In the previous section, Arithmetic order of operations, you saw a little bit of strange behavior when it came to division. I'm going to bring up the same example. In the code, the division equation, 2 / 216 was treated as 0. We know this is obviously not true, so why did Ruby return this value?
When it saw the values 2 and 216, it treated them as integers. So, it assumed that the user would want a rounded value, so it rounded it to the nearest whole number, which is 0 in this case.
To get the correct answer, we'll need to convert it into a decimal, which will automatically give us a float data...