No. Remember from the last chapter that 0.1
can't
be represented precisely in binary.
Using floating point representation does not change anything.
It does not matter that the number is negative.
But
let us proceed to see how -0.1
is (imprecisely)
represented.
0.0001100110011001100110011001100...
1.100110011001100110011001100...
.100110011001100110011001100...
100 1100 1100 1100 1100 1100
127-4 = 123 = 0111 1011
Here are the bits written out:
+- | exponent | Mantissa | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
Write out the bit pattern as hexadecimal.