Nick Coghlan <ncogh...@gmail.com> added the comment:

I think we have a fairly different notion of what clarity means here - I have 
no mental concept whatsoever of how to do two's complement arithmetic with an 
infinite number of sign bits (I learned most of what I know about two's 
complement by working with fixed point 16-bit and 32-bit microprocessors), so 
the infinite bits explanation provides me with very little useful insight, 
whereas I can readily cope with the notion of storing a single extra sign 
extension bit beyond the minimum required to hold the operands' two's 
complement representations.

That said, I do like the idea of using infinite precision arithmetic as the 
formal definition of the intended language semantics, which would lead to 
wording like the following:

=================
Each bitwise operation has the same result as though carried out in two's 
complement with an infinite number of sign bits. In practice, performing the 
calculation with one extra sign extension bit (a bit-width of ``1 + 
max(x.bit_length(), y.bit_length()``) is sufficient to get the expected result.
=================

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue29710>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to