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

3.

0x3AC00000 + 0x3BF00000
1. Extract exponent and fraction bits
• 0x3AC00000

• The IEEE 754 32-bit floating-point representation

3 A C 0 0 0 0 0

0011 1010 1100 0000 0000 0000 0000 0000

8 bits 23 bits
0 01110101 100 0000 0000 0000 0000 0000
Sign Biased Exponent Fraction

• ◘ Biased exponent = 011101012


= 0 x 27 + 1 x 26 + 1 x 25 + 1 x 24 + 0 x 23 + 1 x 2 2 + 0 x 21 + 1 x 20

= 6410 + 3210 + 1610 + 410 + 110


= 11710

◘ Biased exponent = Bias + Exponent


11710 = (28-1 - 1) + Exponent
11710 = 12710 + Exponent
Exponent = 11710 - 12710
Exponent = -1010

• Sign bit = 0
Exponent value = -1010
Fraction bits = 12

• 0x3BF00000

• The IEEE 754 32-bit floating-point representation

3 B F 0 0 0 0 0

0011 1011 1111 0000 0000 0000 0000 0000

8 bits 23 bits
0 01110111 111 0000 0000 0000 0000 0000
Sign Biased Exponent Fraction

• ◘ Biased exponent = 011101112


= 0 x 27 + 1 x 26 + 1 x 25 + 1 x 24 + 0 x 23 + 1 x 2 2 + 1 x 21 + 1 x 20

= 6410 + 3210 + 1610 + 410 + 210 + 110


= 11910

◘ Biased exponent = Bias + Exponent


11910 = (28-1 - 1) + Exponent
11910 = 12710 + Exponent
Exponent = 11910 - 12710
Exponent = -810

• Sign bit = 0
Exponent value = -810
Fraction bits = 1112

2. Prepend leading 1 to form mantisa


• For first number (N1): 1.1 x 2-10

• For second number (N2): 1.111 x 2-8

3. Compare exponents
• -10(N1) – (-8(N2)) = -210
Artinya, lakukan shift right by 2 bits terhadap N1.

4. Shift smaller mantisa if necessary


• Shift N1’s mantissa: 1.1 x 2-10 >> 2 = 0.011 x 2-8

5. Add mantissas
• 0.011 x 2-8
1.111 x 2-8
10.010 x 2-8

6. Normalize mantissa and adjust exponent if necessary


• 10.010 x 2-8 = 1.0010 x 2-7

7. Round result
• Tidak perlu dilakukan rounding karena fraction bits pada hasil penjumlahan tidak
melebihi 23 bits.

8. Assemble exponent and fraction back into floating-point format


• Binary scientific notation = 1.0010 x 2-7
• Biased exponent = Bias + Exponent
= (28-1 - 1) + -710
= 12710 + -710
= 12010

◘ Ubah 12010 menjadi bilangan biner

‣ 120 % 2 = 0
60 % 2 = 0
30 % 2 = 0
15 % 2 = 1
7 %2=1
3 %2=1
1

‣ 12010 = 11110002 = 011110002

• The IEEE 754 32-bit floating-point representation

8 bits 23 bits
0 01111000 001 0000 0000 0000 0000 0000
Sign Biased Exponent Fraction

0011 1100 0001 0000 0000 0000 0000 0000

3 C 1 0 0 0 0 0
Notasi heksadesimal: 0x3C100000

You might also like