Assignment 1: 1. Cover 37.26 (In The Base 10) To It's Equivalent

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Name: Phan Thanh Tân

MSSV: SE170412

ASSIGNMENT 1
1. Cover 37.26 ( in the base 10) to it’s equivalent…
A. Base 16 real number
B. Base 2 real number

Note: You must show the steps in details for the conversions above

A. (37.26)10=(25.428F5C28F5C28F5C28F6)16

● The first convert the integer part 37. Divide repeatedly by 16, keep track of each remainder.
Until we get a quotient that is equal to zero:

# Division = quotient + remainder


37 : 16 = 2 + 5
2 : 16 = 0 + 2
--> (37)10 = (25)16

● Then convert the fractional part: 0.26. Multiply repeatedly by 16, keeping track of each integer
part of the results, until we get a fractional part that is equal to zero:

# Multiplying = integer + fractional part;


➔0.26 * 16 = 4 + 0.16
➔0.16 * 16 = 2 + 0.56
➔0.56 * 16 = 8 + 0.96
➔0.96 * 16 = F + 0.36
➔0.36 * 16 = 5 + 0.76
➔0.76 * 16 = C + 0.1

(Stop because it repeats initial value)

-> (0.26)10=(0.428F5C)16

● Result: (37.26)10=(25.428F5C)16

B. (37.26)10=(100101.0100001010001111011)2

● First convert the integer part 37. Divide repeatedly by 2, keep track of each remainder. Until
we get a quotient that is equal to zero:
# Division = quotient + remainder

37 : 2 = 18 + 1

18 : 2 = 9 + 0

9:2=4+1

4:2=2+0

2:2=1+0

1:2=0+1

--> (37)10=(100101)

● Then convert the fractional part: 0.26. Multiply repeatedly by 2, keeping track of each integer
part of the results, until we get a fractional part that is equal to zero:

# Multiplying = integer + fractional part;

➔0.26 * 2 = 0 + 0.52

➔0.52 * 2 = 1 + 0.04

➔0.04 * 2 = 0 + 0.08

➔0.08 * 2 = 0 + 0.16

➔0.16 * 2 = 0 + 0.32

➔0.32 * 2 = 0 + 0.64

➔0.64 * 2 = 1 + 0.28

➔0.28 * 2 = 0 + 0.56

➔0.56 * 2 = 1 + 0.12

➔0.12 * 2 = 0 + 0.24

➔0.24 * 2 = 0 + 0.48

➔0.48 * 2 = 0 + 0.96

➔0.96 * 2 = 1 + 0.92

➔0.92 * 2 = 1 + 0.84

➔0.84 * 2 = 1 + 0.68
➔0.68 * 2 = 1 + 0.36

➔0.36 * 2 = 0 + 0.72

➔0.72 * 2 = 1 + 0.44

➔0.44 * 2 = 0 + 0.88

➔0.88 * 2 = 1 + 0.76

➔0.76 * 2 = 1 + 0.52

➔0.52 * 2 = 1 + 0.04

➔0.04 * 2 = 0 + 0.08

-->(0.26)10=(0.01000010100011110101110)2

● Result:

(37.26)10=(100101.01000010100011110101110)2

2. Explain in details how 37.26 (in base 10) is save in Excess_127 memory unit.

Sign - Exponent - Mantissa

● Sign:

The sign is positive, so S=0.

● Decimal to binary transformation:

(37.26)10 = (100101.01000010100011110101110)2

Normalization:

--> (1.0010101000010100011110101110)2 x 2^5

● Exponent:

E= 5 + 127 = 132 = (10000100)2

● Mantissa: M= 01000010100011110101011

The presentation is shown below:

0 10000100 01000010100011110101110

S E M
The number is stored in the computer as

0 10000100 01000010100011110101110

3. Normalize 101.1010000 (base 2) and show the Shifter and Mantissa for the same.
The sign is negative
The shifter: 2 + 127 = 129 = (1000 0001)2
Normalize: (101.1010000)2=(1.011010000) x 2^2
Mantissa: 01101000000000000000000
4. Show in detailed steps the result of the following calculation as done in binary through Arithmetic
Logic Operation inside CPU:
32 - 25 =?

Note: The numbers are in Base 10 format. Both numbers are stored in Memory in their 2’s
complements format.

32 - 25 = 32 + (-25) = (+7)

A: (32)10=(0010 0000)2

(25)10=(0001 1001)2

--> Apply two’s complement format: B: (-25)10=(1110 0111)2

1111 Carry

0010 0000 A

+ 1110 0111 B

0000 0111 Result

5. What’s the output from: (10001110) XOR (10111001) Show the steps
10001110
XOR 10111001
00110111
(When the two inputs are 1 and 0, the result is 1; when the two inputs are 1 or 0, the result is 0)

You might also like