Best search algorithm to find condition within a range

Alain Ketterlin alain at
Thu Apr 9 14:56:04 CEST 2015

Marko Rauhamaa <marko at> writes:

> Alain Ketterlin <alain at>:
>> No, it would not work for signed integers (i.e., with lo and hi of
>> int64_t type), because overflow is undefined behavior for signed.
> All architectures I've ever had dealings with have used 2's-complement
> integers. Overflow is well-defined, well-behaved and sign-independent
> wrt addition, subtraction and multiplication (but not division).

You are confused: 2's complement does not necessarily mean modular
arithmetic. See, e.g.,

-- Alain.

More information about the Python-list mailing list