Steven D'Aprano <st...@pearwood.info> wrote: >On Mon, 16 Nov 2015 05:15 pm, Gregory Ewing wrote: > >> Ints are not the only thing that // can be applied to: >> >> >>> 1.0//0.01 >> 99.0 > >Good catch!
Hmmm. I see that the float for 0.01 _is_ slightly larger than 0.01 >>> Decimal(0.01) Decimal('0.01000000000000000020816681711721685132943093776702880859375') But it seems that 1.0 // 0.01 is not directly equivalent to: >>> int(1.0 / 0.01) 100 And I see that: >>> Decimal(1.0 / 0.01) Decimal('100') >>> floor(1.0 / 0.01) 100 >>> 0.01 * 100.0 - 1.0 0.0 So I guess that the // operator is _very_ strict in its "floor division" of floats, but that the "/" operator returns the nearest float value. -- https://mail.python.org/mailman/listinfo/python-list