程序代写代做代考 C • What number does 100 0001 represent? Is it possible to tell? If not, what extra information is needed? What are the possible corresponding types used in C to qualify that number assuming you have enough information to tell what the given number represents?

• What number does 100 0001 represent? Is it possible to tell? If not, what extra information is needed? What are the possible corresponding types used in C to qualify that number assuming you have enough information to tell what the given number represents?
It is not possible to tell what does 100 0001 represent since it didn’t specify the way of representation and the bit it is used to stored. For example, if this number is represented in 7-bit Two’s complement integer then it equals to -63. However, if this number is represented in 8-bit Two’s complement integer then it equals to 65.
We need to know what kind of representation it has. (i.e. signed or unsigned, one’s complement or two’s complement etc.).
The possible types used in C to qualify that number is int, unsigned int, unsigned short, short

• What is the range of a 6-bit unsigned integer representation? Same question for a 6-bit two’s complement integer?
The range of a 6-bit unsigned integer is from 0 to UMax6 = (2^6 – 1) = 0 to 63
The range of a 6-bit two’s complement integer is from to TMin6 = B2T6([100000]) = -(2^5) = -32 to TMax6 = B2T6([011111]) = 24 + 23 + 22 + 21 + 20 = 31

• A positive number(3) has the same representation in one’s complement and in two’s complement. Suppose its representation is interpreted as two’s complement, and its additive inverse(-3) is determined. Now this representation is interpreted as one’s complement(-2), and the additive inverse(2) is determined. Whether interpreted as one’s complement or two’s complement, the result will be the same, since it is a positive number. What is the relationship between this result and the original number?
Didn’t really get the question, so I solved it in two ways:
• For example for positive number 3, its representation is 0011 in two’s complement, and its additive inverse is -3. -3 in two’s complement is 1101 and this is -2 in one’s complement and its additive inverse is 2. But in this way the result is not same..

• A positive number = 3, 0011 in both One and Two, Two inverse = 1101, One inverse = 1100, Two’s inverse is from one’s inverse plus 1.

• Define the tests for detection of overflow in one’s complement addition and subtraction.
-7~7
0011 3
 1111 -0
10010 3
0011 3
0111 7
 0011 3
01010
1010 -5
If the sum > 2w – 1- 1, the number becomes negative and it has a positive overflow
If the sum <= -(2n-1-1), the number becomes positive and it has a negative overflow result + ’carry-on bit’, then the rule is same as two’s complement: • If the sum of two positive numbers yields a negative result, the sum has overflowed. • If the sum of two negative numbers yields a positive result, the sum has overflowed. or we can say: If two numbers with the same sign (both positive or both negative) are added, then overflow occurs if and only if the result has the opposite sign. • Show mathematically that two integers that have a sum of zero have one’s complement representations that are bit-complementary. 1’s complement is useful to store a value with it’s negative representation. If we want to represent -n, it can be represented as ~n. Here 2 cases arises to show the above statement is valid: Case1: If two Integers are both zero’s. Then they do not have one’s complement representation, that are bit-complementary Case2: If they are opposite to each other and if they are non-zero, then we can say that they are bit-complimentary to each other. Example: 8 and -8 (8 bits) Binary representation for 8 : 0000 1000 1’s compliment for ~8: 1111 0111 See that 8 and ~8 are bit complimentary at every bit (i.e. 1 is 0 and 0 is 1) • Assuming a 5-bit IEEE (754 standard) floating-point format where 1 bit is used for the sign, 3 bits for the exponent, and 1 bit for the fraction, write the formulas for the exponent E, the significand M, the fraction f, and the value V for the quantities that follow and also describe the bit representation. Please show all steps to receive full credit. • The number 5.0 • The largest odd integer that can be represented exactly • The reciprocal of the smallest positive normalized value a. V = (-1)s M 2E V = 5.0 = 1012 = 1.01 * 22 Sign bit = because it is positive Bias = k = 2n – 1 – 1 = 23-1 -1 = 3 because 3 bit for exponent E: 510 = 1012 = 1.01 * 22 => E = 2
Exp = E + Bias = 2 + 3 = 5 = 101
f (fraction): 0 (01, because only 1 bit, so just fetch the MSB)
M = 1.010
5.0 -> 0 101 0
b.
000 001 010 011 100 101 110 111
111 exp=7 bias=3 infinity not a number
V = (-1)s M 2E
110 exp = 6 bias=3 E=3 f = 0,1 1000 1100 8,12
101 exp=5 bias=3 E=2 f = 0,1 100 110 4,6
100 exp=4 bias=3 E=1 f = 0,1 10 11 2,3
largest exact odd number should be V=1.1* in binary, which is 3 in decimal
Exp has 3 bits, so its maximum value is 110 (6 in decimal), bias is 3, so max E is 3
however, when E=3, the value is 1.1* or 1.0*, both even numbers
the same situation for E=2
so only when E=1, we can get V=1.1* in binary, which is 3 in decimal
c.
Smallest bit representation: 0 001 0 (normalized value shouldn’t have 000, so 001 would be the smallest)
smallest positive normalized value : 000 111
smallest: 001
Exp=1, Bias=3, E=Exp-Bias=-2 0 001 0
V=1.0* so it’s 0.25 in decimal
The reciprocal of 0.25 is 4 (100 in binary), so represent it as V=1.00*
E=2, Bias=3, Exp=E + Bias=5, which is 101 in binary
so its representation is 0 101 0

• The numbers 10 and -15 are stored in signed representation within a computer that performs only 16-bit two’s complement arithmetic. After the computer adds the two numbers, what is the signed interpretation of the result?
16-bit Two’s Complement for 10: 0000 0000 0000 1010
16-bit Two’s Complement for 15: 0000 0000 0000 1111
16-bit Two’s Complement for -15 = 1111 1111 1111 0000 + 1 = 1111 1111 1111 0001
1111 1111 1111 0001 + 0000 0000 0000 1010 = 1111 1111 1111 1011
Binary for 1111 1111 1111 1011 is 0000 0000 0000 0100 + 1 = 0000 0000 0000 0101
In decimal = 1 * 22 + 1 * 20 = 5 Since the representation starts with 1 which means it is a negative number so it equals -5.

• Given numbers with a binary representation of the form 0.xxxxxx…, where x is a n-bit sequence, provide the numeric value that corresponds to the binary representation for the following values of x.
a. 110
b. 1010
c. 011011
a. 0.110
(0.110)₂ = (0 × 2⁰) + (1 × 2⁻¹) + (1 × 2⁻²) + (0 × 2⁻³) = (0.75)₁₀
b.
(0.1010)₂ = (0 × 2⁰) + (1 × 2⁻¹) + (0 × 2⁻²) + (1 × 2⁻³) + (0 × 2⁻⁴) = (0.625)₁₀
c.
(0.011011)₂ = (0 × 2⁰) + (0 × 2⁻¹) + (1 × 2⁻²) + (1 × 2⁻³) + (0 × 2⁻⁴) + (1 × 2⁻⁵) + (1 × 2⁻⁶) = (0.421875)₁₀

• A computer can be designed to execute a high-level language directly. Why not design this type of computer?
Because low level languages are fast and memory efficient. Also, for a computer system, it is controlled by switches and if the system is in high level language, it would have 10 states from 0 – 9. Then when we want the switch to be on, the voltage has to be very precise to control the switch. However, if it is designed in low level language, then we only need to have two states. Presence of a voltage is state 1 and absence of a voltage is state 0. There is no middle state.

Ex. 0123456789 10v 0-1 1-2 2-3
Ex. 01 switch >5v on <2v off • Convert 0.3 to the nearest floating-point representation (single-precision). What is the difference between the value of that representation and 0.3? V = 0.3 Bias = k = 2n-1 – 1 = 28-1 – 1 = 127 0.3 * 2 = 0.6 | 0 0.6 * 2 = 1.2 | 1 0.2 * 2 = 0.4 | 0 0.4 * 2 = 0.8 | 0 0.8 * 2 = 1.6 | 1 0.6 * 2 = 1.2 | 1 … 0.3 = 0.0100110011…. = 0.0100110011 * 20 = 1.0011 0011 0011 0011 0011 001 * 2-2 => E = -2
=> Exp = E + Bias = -2 + 127 = 125
125 / 2 = 62 + 1
62 / 2 = 31 + 0
31 / 2 = 15 + 1
15 / 2 = 7 + 1
7 / 2 = 3 + 1
3 / 2 = 1 + 1
1 / 2 = 0 + 1
=> 125 = 0111 11012
Frac = 001 1001 1001 1001 1001 1001
Floating-Point Representation(single-precision) =
0 0111 1101 001 1001 1001 1001 1001 1001
*1. 001 1001 1001 1001 1001 1001*
0.01001 1001 1001 1001 1001 1001

This is not exactly 0.3 because binary machine cannot store exactly all real numbers such as 3/10, 1/10….

The value we get from converting back to decimal for this floating-point representation is 0.29999998211860656738, the difference between then due to conversion is
0.3-0.29999998211860656738 = 1.78813934e-8