MESSAGE
DATE | 2014-10-06 |
FROM | mrbrklyn@panix.com
|
SUBJECT | Subject: [NYLXS - HANGOUT] HW 1
|
Q 1 :
Express the decimal number 101 in base 2 to 9 and hexadecimal 1100101 122 65
Q 2 :
Perform the following binary multiplication of two binary numbers: 10011011 and 11001101
Yo have to be kidding me: 10011011 11001101 ________ 10011011 000000000 1001101100 10011011000 000000000000 0000000000000 10011011000000 100110110000000 ___________________ 111110000011111
Q 3 : Perform the following additions of the 3-digit binary numbers, knowing that supplementation 2 is used to represent negative numbers:
000 000 101 111 101 010
001 111 101 110 110 011 --- --- --- --- --- --- 001 111 010 over 101 011 over 101 over
Specify what additions are giving invalid results.
3 > results < -4
Check your results by performing the same operations after converting the numbers into the decimal system.
Q 4 : Convert the decimal number 8.625 into floating point IEEE Standard 754 single precision:
OK - I feel like an idiot. The sides have an almost carbo copy problem. I was looking for an understandable spec. Not until I finally gave up and tried to build a spec from the examples, only then did I see that this problem is almost verbatum of an example. But I'm left with a perplexed question. the slides say normalization happens by putting the decimal left of the left most integer.
This spec puts the \d.\d\d\d etc. The notes are pushing the student off point in this section. the example is negitive, converting -12.625(10). The binary is -1100.101, plain binary. They normalized it to -1.100101 x 2^3
Why? Why not -0.1100101 x2^4. Is this just for negatives? By examination of the other examples, it seems that the deimal is always placed to the RIGHT of the left most digit, not left of it like the author describes as most common usuage.?? Nuh? What can be more common that the single float?
Anyway:
8.625(10) =
8 0 4 0 2 0 1 1
1000
.625 1/250 1 500 0 1/000 1
1000.1010(2)
1.0001010(2) * 2^3
Exponent Bits: 00000011 (2) 01111111 (2) (excess 127 for single precision) _________ 10000010 (2)
Fractional Bits: Loss the leading One (Not sure why, but it is repesented in signed bit 000 1010 0000 0000 0000 0000
Sig Bit is 0
0 1000 0010 000 1010 0000 0000 0000 0000
As this was not covered in tonight’s class, please use following web page to find steps to follow.
http://www.madirish.net/240
Q5
Give the corresponding translation to the following word of 4 bytes encoded in hexadecimal: 49 55 50 31
As:
- A signed integer,
49 55 50 31 0100 1001 0101 0101 0101 0000 0011 0001
1 0,4,5,12,14,16,18,20,22,24,27,30 16 32 4096 16384 65536 262144 1049576 16777216 67108864 134217728 1073741824 --------------- 1230327857 -
- An integer represented in 2's complement,
0100 1001 0101 0101 0101 0000 0011 0001 1011 0110 1010 1010 1010 1111 1100 1110 1 ----------------------------------------- 1011 0110 1010 1010 1010 1111 1100 1111
- A number represented by single precision floating point following the IEEE 754 standard,
Overflow -- but ...
01.001001010101010101000000110001 x2^30
Exp 11110 01111111 (+127) (127 + 30 = 157) --------- 0|10011101|0010010101010101010000 ^thats 23
- A sequence of ASCII characters (each represented with 8 bits, the most significant bit is unused and coded 0)
49 55 50 31 I U P I
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Q6
Consider the following two numbers, encoded according to the IEEE 754 single precision and represented in hexadecimal standard:
3E E0 00 00 and 3D 80 00 00 Hex : 3E E0 00 00 3D 80 00 00
_________________________________________________________________________________________________________________ |Binary : 0011 1110 1110 0000 0000 0000 0000 0000 | 0011 1101 1000 0000 0000 0000 0000 0000 | _________________________________________________________________________________________________________________| |Dec : 1,054,867,456 | 1,031,798,784 | _________________________________________________________________________________________________________________| |754 S :0 100,1110,0 111,1011,10 00,0000,0000,0000 | 0 100,1110,0 111,011 0,0000,0000,0000,0000 | _________________________________________________________________________________________________________________|
Calculate the sum and give the result as IEEE 754 single precision and decimal form.
***Note, I'm not sure if you want to convert first and then do the math or take the sums and then convert. I'll do harder one although adding 754S floats is guessing on my part:
Decimal Sum: 2,086,666,240 Hex Sum: 7C 60 00 00 SINCE they have both the same exponent bits you can add them and remember you have a hidden on in the fraction 1....
1.111,101,110 1.111,011,000 11.111,000,110
carry the one to the exponent 100,1110,1
the new 754s binary for the sum:
0 100,1110,1 111, 1000, 1100, 0000, 0000, 0000: Which translates to
Exp + 0011110 = 30(2)
Fract: 1.111100011(2)
111 1100 0110 0000 0000 0000 0000 0000
which translates 7C 60 00 00 in hex -- bingo
Just to do it the other way
Sum 2086666240
Binary 1111100011000000000000000000000
1.111100011 2^30
30 + 127 = 157 = 10011101 0 100, 1110, 1 111, 1000,11 00,0000,0000,0000
**NOTE Tracking all these decimal places is very hard on my dyslexia ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Same question with the numbers: C8 80 00 00 and C8 00 00 00.
C8 80 00 00 and C8 00 00 00 Hex : C8 80 00 00 C8 00 00 00
_________________________________________________________________________________________________________________ |Binary : 1100 1000 1000 0000 0000 0000 0000 0000 | 1100 1000 0000 0000 0000 0000 0000 0000 | _________________________________________________________________________________________________________________| |Dec : 3,363,831,808 | 3,355,443,200 | _________________________________________________________________________________________________________________| |754 S :0 100,1111,0 100, 1000,1000,0000,0000,0000 | 0 100,1111,0 100 1000,0000,0000,0000,0000 | _________________________________________________________________________________________________________________|
exp = 10011110 (2) exp = 10011110 frac = 100,100,010,000,000,000,000,00 frac = 100 1000 0000 0000 0000 0000
Sum 01 90 80 00 00 0000 0001 1001 0000 1000 0000 0000 0000 0000 0000
754: 1.1001 0000 1000 x 2^32 => 10011111 Sig 0 Sum in 754 S => 0 100,1111,1 100, 1000,0100,0000,0000,0000
Q7
Convert the following number represented as a signed binary integer of 32 bits:
011001010 11100010 10101011 11000101 into real number represented by the IEEE 754 single precision. *********No - this is not 32 bits. This is 33 bits ***************** sig = 0 1.1001010 11100010 10101011 11000101 x 2^31 exp = 10011110
0 100, 1111,0 100,1010,1110,0010,1010,1011 ==>Lost Precision?
Convert the real number obtained into a signed binary integer 32-bit, and compare the results with original number.
There is a loss of precision BUT problem is broken
What conclusions can you deduct?
I'm tired....
|
|