How to calculate decimal and hex values of one and two's complmement binary representation? -
For example, consider an initial value of:
0100 0011
What is this in hex and what is this in decimal, if two supplements have to be used?
Similarly, what is hex and decimal if using a supplement of someone?
More generally, how do you work the hex and decimal values of both forms of binary representation?
Hex is easy, just separate in 4 bit groups and convert each group to decimal. Then, obviously, 10 with A, 11 with A, 12 with C, 13 with D, with the representation of E and 15F hex, usually does not care about one or two supplements And just reflect the bits exactly.
To change the form of decimals: Depending on the complement of one or two, do the job that the signal and the full value will be. If the first bit is 0, then it is positive, if it is negative of 1.
Positive values do not require any further modification. The absolute value of a negative value depends on whether it is complementary to one or two. The complement of one is only negative bits (0 becomes 1, 1 becomes 0). Subtract 1 for the complement of two and then reject the bits.
Then, use the values of bits set to 1 in the whole value. The values of each bit are consistent with two rising exponent powers, which starts with 2 ^ 0 (= 1) for the correct bit, and increases on the left side. Here are some Wikipedia references:
Comments
Post a Comment