1. **Exercise 1: Sign and Decimal Value of Binary Numbers in SAV, CP1, CP2**
Given: $X=11010101$, $Y=11001110$, $Z=01110111$, $T=01010101$ (8 bits each).
- **SAV (Sign and Absolute Value):** The first bit is the sign (0 positive, 1 negative), the rest is magnitude.
- **CP1 (One's Complement):** Negative numbers are represented by inverting all bits of the positive number.
- **CP2 (Two's Complement):** Negative numbers are represented by inverting all bits and adding 1.
**Step 1:** Determine sign and magnitude for each number in SAV.
- $X$: sign bit=1 (negative), magnitude=$1010101_2=85_{10}$, so $X=-85$.
- $Y$: sign bit=1 (negative), magnitude=$1001110_2=78_{10}$, so $Y=-78$.
- $Z$: sign bit=0 (positive), magnitude=$1110111_2=119_{10}$, so $Z=119$.
- $T$: sign bit=0 (positive), magnitude=$1010101_2=85_{10}$, so $T=85$.
**Step 2:** Convert each to decimal in CP1.
- For negative numbers, invert bits.
- $X=11010101$, sign bit=1, so negative.
Invert bits: $00101010_2=42_{10}$, so $X=-42$.
- $Y=11001110$, negative.
Invert bits: $00110001_2=49_{10}$, so $Y=-49$.
- $Z=01110111$, sign bit=0, positive, value $119$.
- $T=01010101$, positive, value $85$.
**Step 3:** Convert each to decimal in CP2.
- For negative numbers, invert bits and add 1.
- $X=11010101$, invert: $00101010$, add 1: $00101011_2=43_{10}$, so $X=-43$.
- $Y=11001110$, invert: $00110001$, add 1: $00110010_2=50_{10}$, so $Y=-50$.
- $Z=01110111$, positive, $119$.
- $T=01010101$, positive, $85$.
---
2. **Exercise 2: Express integers X=26, Y=38 in 7 bits SAV, CP1, CP2 and operations**
**Step 1:** Express $X=26$ and $Y=38$ in 7 bits.
- Binary $26=0011010$, $38=0100110$.
**SAV:**
- $X=0011010$ (positive)
- $-X=1011010$ (sign bit 1, magnitude 26)
- $Y=0100110$
- $-Y=1100110$
**CP1:**
- $X=0011010$
- $-X$: invert bits $1100101$
- $Y=0100110$
- $-Y$: invert bits $1011001$
**CP2:**
- $X=0011010$
- $-X$: invert bits $1100101$ add 1 $1100110$
- $Y=0100110$
- $-Y$: invert bits $1011001$ add 1 $1011010$
**Step 2:** Is 6-bit codification possible?
- Max positive in 6 bits SAV is $011111=31$, so yes for 26 and 38 no (38>31).
- So 6 bits not possible for 38.
**Step 3:** Perform operations $X-Y$, $Y-X$, $X-Y$ in 7 bits SAV, CP1, CP2.
- $X-Y=26-38=-12$
- $Y-X=38-26=12$
**SAV:**
- $X=0011010=26$
- $Y=0100110=38$
- $X-Y$: sign bit 1, magnitude 12 = $1001100$
- $Y-X$: sign bit 0, magnitude 12 = $0001100$
**CP1:**
- $X=0011010$
- $Y=0100110$
- $X-Y$: $X + (-Y)$, $-Y$ invert $1011001$
Add: $0011010 + 1011001 = 1110011$ (no overflow), decimal -12
- $Y-X$: $Y + (-X)$, $-X$ invert $1100101$
Add: $0100110 + 1100101 = 1001011$ (overflow ignored), decimal 12
**CP2:**
- $X=0011010$
- $Y=0100110$
- $-Y=1011010$
- $X-Y$: $0011010 + 1011010 = 1110100$ decimal -12
- $Y-X$: $0100110 + 1100110 = 1001100$ decimal 12
---
3. **Exercise 3: Binary expressions and arithmetic for A=109, B=18, C=36**
**Step 1:** Express in base 2:
- $A=109_{10} = 1101101_2$
- $B=18_{10} = 10010_2$
- $C=36_{10} = 100100_2$
**Step 2:** Perform $A+B$, $A+C$, $B+C$ in SAV, CP1, CP2.
- $A+B=109+18=127$
- $A+C=109+36=145$
- $B+C=18+36=54$
Number of bits:
- Max sum 145 requires at least 8 bits.
**SAV:**
- $A=01101101$
- $B=00010010$
- $C=00100100$
- $A+B=01111111$ (127)
- $A+C=10010001$ (sign bit 1 invalid for positive, so 8 bits needed)
- $B+C=00110110$ (54)
**CP1 and CP2:** Same binary addition applies, with sign handling.
**Step 3:** Perform $A-B-C$ and $B-A-C$ in SAV, CP1, CP2 on 8 bits if possible.
- $A-B-C=109-18-36=55$
- $B-A-C=18-109-36=-127$
In 8 bits:
- $55=00110111$
- $-127$ in CP2: invert $01111111$ to $10000000$ add 1 $10000001$
---
4. **Exercise 4: Fixed-point binary and hexadecimal coding for X=25.125, Y=39.625, Z=123**
**Step 1:** Express X and Y in fixed-point binary (assume 3 fractional bits):
- $25.125 = 11001.001_2$
- $39.625 = 100111.101_2$
**Step 2:** Express X and Y in fixed-point hexadecimal:
- $25.125 = 19.2_{16}$ (since 0.125 = 0.2 in hex)
- $39.625 = 27.A_{16}$
**Step 3:** Perform $X+Y$ and $X-Y$ in binary:
- $X+Y=11001.001 + 100111.101 = 111000.110_2 = 64.75_{10}$
- $X-Y=11001.001 - 100111.101 = -11110.100_2 = -14.5_{10}$
---
5. **Exercise 5: IEEE-754 coding and decoding**
**Step 1:** Encode $X=70.75$, $Y=-250.5$, $Z=0.375$ in IEEE-754 single precision.
- $70.75_{10} = 1.000111011 imes 2^6$
- $Y=-250.5 = -1.111101001 imes 2^7$
- $Z=0.375 = 1.1 imes 2^{-2}$
Encode sign, exponent (bias 127), mantissa accordingly.
**Step 2:** Decode $X=(11011000011010110000000000000000)_2$.
- Sign=1 (negative)
- Exponent bits=10110000 (176 decimal)
- Mantissa=11010110000000000000000
- Real value $= -1.M imes 2^{176-127} = -1.4140625 imes 2^{49}$ (approximate)
---
6. **Exercise 6: Hexadecimal and base conversions, roots, IEEE-754**
**Step 1a:** $X=4015.9375_{10}$ to base 16:
- Integer part: $4015_{10} = FA7_{16}$
- Fractional part: $0.9375 = 0.F_{16}$
- So $X=FA7.F_{16}$
- Base 2: $111110100111.1111_2$
- Base 8: $17517.74_8$
**Step 1b:** $Y=(50)_{16} = 80_{10}$
**Step 1b-1:** $Z=X+Y=4015.9375 + 80 = 4095.9375$
- Base 16: $FFF.F_{16}$
- Base 2: $111111111111.1111_2$
**Step 1b-2:** Calculate cube roots:
- $
oot 3
oot 3 Z =
oot 3 {4095.9375} hickapprox 16$ (approximate)
- Express in base 2: $10000_2$
**Step 1b-3:** Largest $n$ so that $n$-th root of $Z > 1$ is $n=12$ (since $2^{12}=4096$)
**Step 2a:** $A=(FAF.F)_{16}$
- Express as $A = ext{sign} imes 1.M imes 2^E$
**Step 2b:** IEEE-754 single precision binary representation of $A$ (32 bits)
**Step 2c:** Internal hexadecimal representation of $A$
**Step 2d:** Hex representation of $B=-A$
---
Final answers are detailed above for each exercise.
Binary Coding Arithmetic 7Dab51
Step-by-step solutions with LaTeX - clean, fast, and student-friendly.