Binary addition. Is this an overflow?

Binary values ​​are in the form of additions 2s.

If I have to add 110001 (-15) and 101110 (-18), and the answer should be stored in a 6-bit integer, this is underflow / overflow.

+3
source share
3 answers

This overflow, your professor is right. You save more bits that can be held in the allocated space (although the number that the bits represent is negative.)

Underflow is when a bit gets zero due to bias in a lot of math. Very often in fixed-point math. Divide a very small number by a very large number, and you pretty often get 0. This is underutilization.

+2

-70 -90 .

Let assume R1[8 bits] = -70 R2[8 bits] = -90 Result[9 bits] = -160, an extra bit for overflow.

overflow_signed_detection 1 . , , .

+1

EDIT: , -33 6 , -33, +31, , , :)

, . ( ).

, 0x7fffffff 0x00000001, 0x80000000, , , .

, ?

0

Source: https://habr.com/ru/post/1743091/


All Articles