I'm trying to write a binary 8 bit floating point addition algorithm for a picoblaze microcontroller (1 sign bit, 4 exponent bits, and 3 mantissa bits)
I got it to work with positive numbers but I can't figure out how to do it when there are negative numbers too.
My main problem is setting the sign bit of the result, can someone explain how to set it correctly?
My idea was to check the sign of both numbers; then if they're both positive set the sign to 0, if they're both negative set the sign to 1 and use the same methods as before for the addition, and if one is negative and one is positive compare the numbers and use the sign bit of the larger one, but I'm not sure how to compare the two numbers and the code is getting a little cluttered, is there a better way to do it?