Dyslexicbloke:
NO I compared a signed byte to a signed int...
You are actually not comparing the two numbers. You are subtracting one from the other. From a human's perspective it's a difference without a distinction. From a computer's perspective subtraction is sign agnostic.
I'll start with single bit integers. We can store a zero or a one. Addition is...
0 + 0 = 0
1 + 0 = 1
0 + 1 = 1
1 + 1 = 10
That last entry is a problem. We only have one bit to store numbers. Because we have no place to store that extra bit it gets tossed in the waste bin. Addition becomes...
0 + 0 = 0
1 + 0 = 1
0 + 1 = 1
1 + 1 = 0
Subtraction is...
0 - 0 = 0
1 - 0 = 1
0 - 1 = 11 (in "human" subraction we borrow from the place to the left; the computer does the same)
1 - 1 = 0
That third entry is a problem. We only have one bit to store numbers. Because we have no place to store those extra bits they get tossed in the waste bin. Subtraction becomes...
0 - 0 = 0
1 - 0 = 1
0 - 1 = 1
1 - 1 = 0
Looks like the addition truth table. Let's continue with two bits...
00 + 00 = 00
01 + 00 = 01
10 + 00 = 10
11 + 00 = 11
00 + 01 = 01
01 + 01 = 10
10 + 01 = 11
11 + 01 = 100 --> 00
00 + 10 = 10
01 + 10 = 11
10 + 10 = 100 --> 00
11 + 10 = 101 --> 01
00 + 11 = 11
01 + 11 = 100 --> 00
10 + 11 = 101 --> 01
11 + 11 = 110 --> 10
Now for subtraction...
00 - 00 = 00
01 - 00 = 01
10 - 00 = 10
11 - 00 = 11
00 - 01 = 111 --> 11
01 - 01 = 00
10 - 01 = 01
11 - 01 = 10
00 - 10 = 110 --> 10
01 - 10 = 111 --> 11
10 - 10 = 00
11 - 10 = 01
00 - 11 = 101 --> 01
01 - 11 = 110 --> 10
10 - 11 = 111 --> 11
11 - 11 = 00
Stil looks like the addition truth table.
-32763 - 32762 = -65525 whether you use a calculator or a spreadsheet,
Unless its an int ...
-32763 - 32762 = 11
This is a perfect example of subtraction overflowing (the subtraction examples above with "-->"). -65525 requires 17 bits to store. But only 16 bits are available. The right-most bit goes in the trash and, in the remaining 16 bits, we have 11.