I am a bit unclear about underflowing in terms of binary representation.
Let's say that an unsigned 8-bit variable gets overflown from the addition of $150+150$.
A signed 8-bit variable gets underflown after the subtraction of $-120-60$.
Now my point is let's think of 8-bit variable, we are subtracting $110-10$. Now let's convert this into an addition, $110+(-10)$. Since $-10$ is $11110110$ and $110$ is $01101110$. If we add these two binary numbers we will have a value after 8th bit to carry, which is I believe an overflown, however the final binary number is equal to $100$ and that's what we want and in terms of decimal value we did not lose anything. In that case do we have a overflow or underflow here?
You don't have an overflow here: the result will be
01100100. Since the top bit indicates the sign, the addition process is not the same as for unsigned integers.For example,
01100100+01100100overflows for signed integers, because we can't carry from the 7th bit into 8th: the 8th bit is the sign. Over unsigned integers, there is no overflow.Conversely,
01100100+11110110overflows for unsigned integers, but not for signed ones.My point is: the process of adding of numbers represented by binary strings depends on what representation is used. (You would not add floating point representations bitwise...)