INT (short for integer)
- Takes a value and returns its closest integer that is also CLOSEST to zero.
- Keyword(s): CLOSEST (to 0)!
FLOOR
- Takes a value and rounds it to the nearest SMALLEST integer.
- Keyword: SMALLEST!
At first, these two functions sound the same. In the chart below, we have some random decimal values, their FLOOR result, and their INT result. The last column will indicate for us if the FLOOR and the INT are the same, simply for the sake of quick analysis.
![](https://www.thedataschool.co.uk/content/images/2024/03/image-51.png)
As we can see, independent of their rounded values, we are obtaining the same result for the FLOOR and INT values.
For each of the original values, the FLOOR function is returning the smallest and closest integer, the integer that is before it. If we lived in a world where rounding rules did not exist, then we could say that the FLOOR function is always rounding the value down to the nearest integer. We can see this with a few of the examples above. If we were to round 2.32 down, it would round to 2. Between our options of 2 and 3, 2 is the smallest and closest to 2.32. If we were to round 2.76 down, we would also get 2 as a result. Although it is not the closest to 2.76, of the two options, 2 and 3, 2 is the smallest.
For each of the original values, the INT function is returning the integer that is both closest to that value and closest to 0. In the case of 2.32, again, the integers we would debate between are 2 and 3. Yes. 2.32 natually rounds to 2. However, of the options, 2 is closest to 0, so INT(2.32) will result in 2. On the other hand, in the case of 2.76, we would still debate between 2 and 3. Now, while 2.76 naturally rounds to 3, 2 is the closest to 0. So, INT(2.76) = 2.
So, we are getting the same results for each function. What is the difference?
The difference lies in the negatives!
When working with negative values, the smallest integer and the integer closest to 0 move in opposing directions. Recall from middle school math that as negatives approach 0, they are larger in value. On the contrary, the more negative a value is, the smaller it is.
Notice how this plays out in the table below.
![](https://www.thedataschool.co.uk/content/images/2024/03/image-52.png)
Keywords:
- FLOOR → SMALLEST!
- INT → CLOSEST (to 0)!
When we are working with negatives, the next smallest integer will always exist to the left of the value on a number line. So therefore, FLOOR(negative value) will always return the negative integer that is smaller than or equal to the value in question. With -2.32, the closest smallest integer is -3 (even though it is much closer to -2). The same is true for -2.76!
As for the INT function, we are looking for the closest integer that is also closest to 0. In this case, INT(negative value) will always return the integer that is larger than or equal to the value in question. Again, for -2.32 this would be -2 and the same result would be obtained for -2.76 (even though it is much closer to -3).
![](https://www.thedataschool.co.uk/content/images/2024/03/image-53.png)