tasm - Assembly Language -Addition of two signed numbers -


dear stackoverflow community

question : given 2 signed numbers x = 01111110 (base 2) , y = 00001000 (base 2) .explain why x + y operation result wrong results?

my attempt : (understanding) research sign number magnitude way x + y wrong if answer overflows sign.

please can me, have researched , read sign magnitude, ones complement , twos complement ,but still find confusing.

thank taking time , patience see question.

assuming signed integers 8 bit wide, it's said: it's overflowing in sign bit, (in 2's complement) results in wraparound.

01111110 + 00001000 = 10000110 

as can see, summing 2 positive values (126 , 8, both have sign bit not set) resulted in negative value (it has sign bit set; in 2's complement, it's -122), wrong.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -