When you perform Integer division, the fractional part is discarded, as Integers cannot hold decimals. In other words,
12 / 5 is 2, not 2.4, but
12.0 / 5 or
12 / 5.0 will output the correct result.
Sometimes it's acceptable to use Integer values, such as when you're trying to calculate the number of pages in pagination (
(recordCount + pageSize - 1) / pageSize gives the total number of pages, including a partial last page), or when you have some sort of algorithm that explicitly discards fractional results. You should always make sure that you know if you want to discard the fractional values.
Also, note the concept of automatic upcasting; if either parameter is a Decimal, then the other parameter is automatically converted as well. As an example, if you write
12 / ( 1.0 + 4 ), you'll end up with the correct value of 2.4, because first the 4 will be converted to 4.0, which results in
12 / 5.0, which will again convert the 12 to a Decimal (
12.0 / 5.0), resulting in the correct output.