Question 1 Everything stored on a computer can be represented as a string of bit
ID: 3640331 • Letter: Q
Question
Question 1
Everything stored on a computer can be represented as a string of bits. However, different types of data (for example, characters and numbers) may be represented by the same string of bits. For this question, we assume that text characters (or symbols) are stored in 8 bit ASCII code and that numbers are stored in 12 bits. We also assume that when the number is stored as a floating point (real) number, 6 of these bits are reserved for the mantissa (or significand) with 2k-1-1 as the exponent bias (where k is the number of bits for the characteristic).
For example, the string of bits 001101100011100100110101 might represent the three characters in 695 or two numbers, which will be different depending on whether the numbers are stored as integers (867 and -1739 here) or as floating point numbers (0.13671875 and -0.00040435791015625 here). More precisely, any real number between 0.13671875 and 0.140625 will have the same floating point representation in this, not very accurate, scheme. Similarly, any real number between -0.00040435791015625 and -0.0004119873046875 will also have the same computer representation.
(a) Find the computer representation for the negative integer -1231 and the negative floating point number -1231.
Please show full working
Explanation / Answer
please rate - thanks
negative numbers are stored in 2's complement
for -1231 integer
find 1231 integer (I'll assume you can do that)
it is 10011001111
you want 12 bits so you are starting with
010011001111
to get 2's complement
flip the bits and get
101100110000
add 1 + 1
101100110001 = -1231 as an integer
for the floating point number you've been given 12 bits, 1 for the sign bit, 6 for the mantissa, and that leaves 5 for the exponent
the word would look like
s eeeee mmmmmm
-1231 is negative, so the sign bit is 1
again 1231 in binary is 010011001111
change this to sientific notation and you get 1.0011001111 x 2^10
so the exponent is 10, and the mantissa is 0011001111 the 1. is dropped since it is always 1.
also we will only use the 6 most significant bits
so far we have as the answer
1 eeeee 001100
the exponent, 10, has to be "biased"
you were told
2k-1-1 as the exponent bias (where k is the number of bits for the characteristic).
there are 5 bits, so the bias is 2^4-1 or 15
so take the 10, add 15, get 25, and convert to binary, to get the exponent 11001
so your answer is 111001001100 = -1231 as a float in 12 digits
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.