error on "Addition, Subtraction, Multipli..." page

On this page it says

This also means that the operation can overflow if the result is larger than that which can be stored in the data type (e.g. adding 1 to an int with the value 32,767 gives -32,768)

Doesn’t adding 1 give 0? And adding 2 give -32,768?

BTW, many thanks for having these pages available. I knew there was some trick to divinding two integers and getting a float, and this page reminded me what it was.

Perhaps it would be a good exercise to test this yourself to check whether reality matches the online reference or your expectation:

int number=32767;


So BenF.. What was the outcome of your program? Does it work or not?

Should we not let Kitep enlighten us? :wink:

I think both you and I know what the output will be. Printing the hex values from each step may also illustrate more clearly what happens when you increment a signed number past its max value.

Or just google "Two's complement"

Actually, I seem to have had a brain fart last night when I posted it. That's what I get for staying up too late. :frowning: