In: Computer Science
Represent the value -65.75 in single and double precision. Please show all work.

a)
-65.75
Converting 65.75 to binary
Convert decimal part first, then the fractional part
> First convert 65 to binary
Divide 65 successively by 2 until the quotient is 0
> 65/2 = 32, remainder is 1
> 32/2 = 16, remainder is 0
> 16/2 = 8, remainder is 0
> 8/2 = 4, remainder is 0
> 4/2 = 2, remainder is 0
> 2/2 = 1, remainder is 0
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1000001
So, 65 of decimal is 1000001 in binary
> Now, Convert 0.75000000 to binary
> Multiply 0.75000000 with 2. Since 1.50000000 is >= 1. then add 1 to result
> Multiply 0.50000000 with 2. Since 1.00000000 is >= 1. then add 1 to result
> This is equal to 1, so, stop calculating
0.75 of decimal is .11 in binary
so, 65.75 in binary is 01000001.11
-65.75 in simple binary => 1000001.11
so, -65.75 in normal binary is 1000001.11 => 1.00000111 * 2^6
single precision:
--------------------
sign bit is 1(-ve)
exponent bits are (127+6=133) => 10000101
Divide 133 successively by 2 until the quotient is 0
> 133/2 = 66, remainder is 1
> 66/2 = 33, remainder is 0
> 33/2 = 16, remainder is 1
> 16/2 = 8, remainder is 0
> 8/2 = 4, remainder is 0
> 4/2 = 2, remainder is 0
> 2/2 = 1, remainder is 0
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 10000101
So, 133 of decimal is 10000101 in binary
frac/significant bits are 00000111000000000000000
so, -65.75 in single-precision format is 1 10000101 00000111000000000000000
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 binary to hexadecimal
Converting 11000010100000111000000000000000 to hexadecimal
1100 => C
0010 => 2
1000 => 8
0011 => 3
1000 => 8
0000 => 0
0000 => 0
0000 => 0
So, in hexadecimal 11000010100000111000000000000000 is 0xC2838000
in hexadecimal it is 0xC2838000
b)
64-bit format:
--------------------
sign bit is 1(-ve)
exponent bits are (1023+6=1029) => 10000000101
Divide 1029 successively by 2 until the quotient is 0
> 1029/2 = 514, remainder is 1
> 514/2 = 257, remainder is 0
> 257/2 = 128, remainder is 1
> 128/2 = 64, remainder is 0
> 64/2 = 32, remainder is 0
> 32/2 = 16, remainder is 0
> 16/2 = 8, remainder is 0
> 8/2 = 4, remainder is 0
> 4/2 = 2, remainder is 0
> 2/2 = 1, remainder is 0
> 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 10000000101
So, 1029 of decimal is 10000000101 in binary
frac/significant bits are 0000011100000000000000000000000000000000000000000000
so, -65.75 in 64-bit format is 1 10000000101 0000011100000000000000000000000000000000000000000000
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 binary to hexadecimal
Converting 1100000001010000011100000000000000000000000000000000000000000000 to hexadecimal
1100 => C
0000 => 0
0101 => 5
0000 => 0
0111 => 7
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
So, in hexadecimal 1100000001010000011100000000000000000000000000000000000000000000 is 0xC050700000000000
in hexadecimal it is 0xC050700000000000