Timeline for If a number is too big does it spill over to the next memory location?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:40 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Jan 22, 2016 at 7:24 | comment | added | robert bristow-johnson |
i suppose it isn't in the C standard, but i suppose there could be an implementation where regular binary arithmetic is not used for int . i s'pose they could use Gray code or BCD or EBCDIC. dunno why anybody would design hardware to do arithmetic with Gray code or EBCDIC, but then again, i dunno why anyone would do unsigned with binary and do signed int with anything other than 2's complement.
|
|
Jan 22, 2016 at 7:18 | comment | added | robert bristow-johnson | well, standards sometimes are anachronistic. looking at the SO reference, there is one comment that hits it directly: "The important note here, though, is that there remain no architectures in the modern world using anything other than 2's complement signed arithmetic. That the language standards still allow for implementation on e.g. a PDP-1 is a pure historical artifact. – Andy Ross Aug 12 '13 at 20:12" | |
Jan 22, 2016 at 6:07 | comment | added | Vaughn Cato | @robertbristow-johnson: Not according to the C standard. | |
Jan 22, 2016 at 6:00 | comment | added | robert bristow-johnson | signed integer overflow is just as well-defined as is unsigned integer overflow. if the word has $N$ bits, the upper boundary of signed integer overflow is at $$ 2^{N-1}-1 $$ (where it wraps around to $-2^{N-1}$) whereas the upper boundary for unsigned integer overflow is at $$ 2^N - 1$$ (where it wraps around to $0$). same mechanisms for addition and subtraction, same size of the range of numbers ($2^N$) that can be represented. just a different boundary of overflow. | |
Jan 20, 2016 at 13:23 | history | edited | Vaughn Cato | CC BY-SA 3.0 |
added 154 characters in body
|
Jan 20, 2016 at 13:13 | history | answered | Vaughn Cato | CC BY-SA 3.0 |