[issue39703] Floor division operator and floats

2020-02-20 Thread Mark Dickinson
Mark Dickinson added the comment: > Thanks and apologies for missing the duplicate. Not a problem: much better to have a potential bug reported twice than not at all. -- ___ Python tracker

[issue39703] Floor division operator and floats

2020-02-20 Thread Kostis Gourgoulias
Kostis Gourgoulias added the comment: Aha, I see! Thanks and apologies for missing the duplicate. -- ___ Python tracker ___ ___ Pyt

[issue39703] Floor division operator and floats

2020-02-20 Thread Mark Dickinson
Mark Dickinson added the comment: Ah, found the duplicate (or at least one of them): https://bugs.python.org/issue27463 -- components: +Interpreter Core -macOS resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Floor division is not the same as the fl

[issue39703] Floor division operator and floats

2020-02-20 Thread Mark Dickinson
Mark Dickinson added the comment: > Shouldn't the two approaches provide the same answer? In a word, no. :-) math.floor(1/0.01) involves *two* operations, and there's an intermediate rounding step which happens to round the true mathematical result of 1/0.01 up to 100.0. Taking the floor of

[issue39703] Floor division operator and floats

2020-02-20 Thread Kostis Gourgoulias
New submission from Kostis Gourgoulias : This was brought to my attention by a colleague, Albert B. When considering the floor division // operator, 1//0.01 should return 100.0, but instead returns 99.0. My understanding is that this is because 0.01 is represented by Decimal('0.0100