This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients
Date 2017-11-06.07:05:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id
In-reply-to
Content
Mentioning “sufficient space” is nice because it relieves concerns about overflows and running out of bits. But “sufficient space for the absolute value” seems tricky if not misleading, because two’s complement does not directly record the absolute value, and extreme values like -128 need less bits in two’s complement (7 + sign) than with a separate magnitude (8 + sign).

What about:

“Bitwise operations have the same result as calculations using two’s complement with a bit-width large enough to avoid overflows.”

I’m not sure that a precise definition is necessary, but I would say a bit-width k must be chosen such that -2**(k-1) <= x < 2**(k-1) for all operands x (and for the left shift x << n, the width must be k + n).
History
Date User Action Args
2017-11-06 07:05:44martin.panterlinkissue29710 messages
2017-11-06 07:05:43martin.pantercreate