The languages you cite use either IEEE-754 64-bit binary floating-point or use the floating-point of the underlying hardware, which is likely IEEE-754 binary floating-point.
In IEEE-754 64-bit binary floating-point, the nearest representable value to 8.2 is 8.199999999999999289457264239899814128875732421875, and the nearest representable value to .2 is 0.200000000000000011102230246251565404236316680908203125.
So, when you write 8.2 - 0.2
, what actually happens is that 0.200000000000000011102230246251565404236316680908203125 is subtracted from 8.199999999999999289457264239899814128875732421875. The result is a value slightly under 8, and the floor of a value slightly under 8 is 7.
The lesson here is that floating-point arithmetic is generally approximate, so you must be careful when evaluating functions with discontinuities (like floor) or steep slopes. You must either design your code to accept results that may cross the discontinuities or you must design your calculations to avoid errors that cross the discontinuities.