Best search algorithm to find condition within a range

Chris Angelico rosuav at
Thu Apr 9 16:08:27 CEST 2015

On Thu, Apr 9, 2015 at 11:57 PM, Alain Ketterlin
<alain at> wrote:
> Because, in:
>     z = x+y; // all signed ints
>     if ( z < x )
>         ...
> either there was no overflow (and the condition is false), or there was,
> and the result is undefined, i.e., "z<x" can be considered false also.

Do you mean "all unsigned ints" here? Because if y is negative, the
condition will be true without overflow. If you didn't, then I'm
puzzled as to where the undefined behaviour is coming from.


More information about the Python-list mailing list