Floating-point conversion and arithmetic
Adding floating-point numbers
- Normalise
- Match the exponent
- Add the mantissas
Using 8.4 two's-complement floating-point, add 010111010111 and 011110000101
A = 010111010111
B = 011110000101 = 000111100111
A + B = (01011101 + 00011110)0111 = 011110110111
Exercises
-
Using 8.4 two's-complement floating-point, add 011001010101 and 010110100011
A = 011001010101
B = 010110100011 = 000101100101
A + B = (01100101 + 00010110)0101 = 011110110101 -
Represent the number 55 in normalised two's-complement floating-point notation, using as few bits as possible
55 = 0110111 = 0.110111 « 6 = 01101110110 (7.4)
-
A computer represents numbers using normalised 6.4 two's-complement floating-point representation (why though, it's 10 bits).
Add the following three numbers together and give the answer in the format described. You must show your working.
010100 0010 011000 0001 100010 0010 ------------ shift mantissas so exponent == 0010 010100 0010 001100 0010 100010 0010 ============ add mantissas 000010 0010 ------------ normalise 010000 1111