If you look closer at what happens in this concrete example, the influence of the binary format becomes more visible.
The input is stored as a binary floating point approximation. This then can be printed as decimal number uniquely identifying the binary,
In [1]: print "%.25f"%2.4
2.3999999999999999111821580
In [2]: print "%.25f"%0.8
0.8000000000000000444089210
The first step is the computation of the quotient and of its integer part. Obviously, as the stored numbers are smaller 2.4
and larger 0.8
, the quotient is smaller than 3
,
In [3]: print "%.25f"%(2.4/0.8)
2.9999999999999995559107901
The modulo result, the remainder, is then finally the difference after removing the integer multiple,
In [4]: print "%.25f"%(2.4-2*0.8)
0.7999999999999998223643161