22 ms·
That's a reasonable tradeoff for Python, but it's worth noting that there is a way to deal with this. Quoting from http://reference.wolfram.com/language/tutori
by brandonbloom 10y ago
That's a reasonable tradeoff for Python, but it's worth noting that there is a way to deal with this.
Quoting from http://reference.wolfram.com/language/tutorial/IntegerAndNumberTheoreticalFunctions.html http://reference.wolfram.com/language/tutorial/IntegerAndNum...
Bitwise operations are used in various combinatorial
algorithms. They are also commonly used in manipulating
bitfields in low‐level computer languages. In such
languages, however, integers normally have a limited
number of digits, typically a multiple of 8. Bitwise
operations in the Wolfram Language in effect allow
integers to have an unlimited number of digits. When an
integer is negative, it is taken to be represented in
two's complement form, with an infinite sequence of ones
on the left. This allows BitNot[n] to be equivalent
simply to (-1 - n).
- gpvos 10y agoYes, but how would you print that infinite sequence of 1s?
- ema 10y agosame as the infinite number of zeros in front of a positive number.
- AstralStorm 10y agoJust trimming 1s would be ambiguous. Is b11 3 or -2? You would have to add a 0 prefix to all positive numbers or some other to negative.
- brandonbloom 10y agoJust prefix a + or - just like you do for base 10.
- gpvos 10y agoSo then it would not make much of a difference anymore with what Python does. Which was what they wanted to avoid.