In: Computer Science
Convert signed integer 0xACE9 to binary and decimal.
Convert unsigned integer0xACE9 to binary and decimal.
1) Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from hexadecimal to binary Converting ACE9 to binary A => 1010 C => 1100 E => 1110 9 => 1001 So, in binary ACE9 is 1010110011101001 Answer in binary: 1010110011101001 => 1010110011101001 => 1x2^15+0x2^14+1x2^13+0x2^12+1x2^11+1x2^10+0x2^9+0x2^8+1x2^7+1x2^6+1x2^5+0x2^4+1x2^3+0x2^2+0x2^1+1x2^0 => 1x32768+0x16384+1x8192+0x4096+1x2048+1x1024+0x512+0x256+1x128+1x64+1x32+0x16+1x8+0x4+0x2+1x1 => 32768+0+8192+0+2048+1024+0+0+128+64+32+0+8+0+0+1 => 44265 Answer in decimal: 44265 2) Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111 Use this table to convert from hexadecimal to binary Converting ACE9 to binary A => 1010 C => 1100 E => 1110 9 => 1001 So, in binary ACE9 is 1010110011101001 Answer in binary: 1010110011101001 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 1010110011101001 is flipped to 0101001100010110 II. Add 1 to above result 0101001100010110 + 1 = 0101001100010111 III. Now convert this result to decimal value => 101001100010111 => 1x2^14+0x2^13+1x2^12+0x2^11+0x2^10+1x2^9+1x2^8+0x2^7+0x2^6+0x2^5+1x2^4+0x2^3+1x2^2+1x2^1+1x2^0 => 1x16384+0x8192+1x4096+0x2048+0x1024+1x512+1x256+0x128+0x64+0x32+1x16+0x8+1x4+1x2+1x1 => 16384+0+4096+0+0+512+256+0+0+0+16+0+4+2+1 => 21271 Answer in decimal: -21271