On Fri, Feb 17, 2017 at 9:00 PM, <josef.pktd@gmail.com> wrote:
>
> just an observation
>
> >>> bwi
> 25
> >>> - bwi // 2 # not what I wanted
> -13
> >>> 0 - bwi // 2
> -12
> >>> - (bwi // 2)
> -12
>
> different rules from float division
>
> >>> 0 - bwi / 2
> -12.5
> >>> - bwi / 2
> -12.5
>
> bug in my code
The rules (of operator precedence) are the same in both cases; unary negation binds tighter than either division, which in turn binds tighter than binary subtraction. It's just that in the latter case, both orders of operations just happen to give the same result for these values.
--
Robert Kern