In a 8 bit CPU register -1 is written as 11111111.
In a 16 bit CPU register -1 is written as 1111111111111111.
And so on.
Say, that our register has an infinite number of bits. Then -1 is written as ….111111.
With the infinite number of 1s on the left.
32 is written as …0000100000.
With the infinite number of 0s on the left.
So we have:
+…000000001 (1 decimal)
+…000000010 (2 decimal)
+…000000100 (4 decimal)
+ ….
+ ….
——————-
+…111111111111 (-1 decimal)
It’s not a joke. At least not more of a joke than the title is.
Advertisements
In fact the result is a good case of stack overflow.
In the real world only. But in the mathematics Leonhard Euler has started, this is a routine now.
‘As everybody knows, 1 + 1 + 1 + ⋯ = − 1/2.’
https://en.wikipedia.org/wiki/1_%2B_1_%2B_1_%2B_1_%2B_%E2%8B%AF#cite_note-2
You got me there, my maths ends with picking [pseudo] random numbers for lottery.
The result looks similar than what you get when trying to list the sum of all natural numbers 1+2+3+4+…= -1/12
Interesting thing, infinity.
Both results are from the same line of reasoning. Not everybody is thrilled, thoug. I am quite reserved even toward 1/2+1/4+1/8 … = 1.
Still, it’s fun to play with hypotheticals, also.