Digital Design Discussion: Numbers Binary to Decimal Conversion - - PowerPoint PPT Presentation
Digital Design Discussion: Numbers Binary to Decimal Conversion - - PowerPoint PPT Presentation
Principles Of Digital Design Discussion: Numbers Binary to Decimal Conversion Decimal to Binary Conversion Floating-Point Conversion Positional Number System Each number is represented by a string of digits, in which the position of each
Numbers DIGITAL DESIGN 101, University of California
Positional Number System
Each number is represented by a string of digits, in
which the position of each digit has an associated weight
1234.5610 = 1 ∙ 103 + 2 ∙ 102 + 3 ∙ 101 + 4 ∙ 100 + 5 ∙ 10-1 + 6 ∙ 10-2
1101.112 = 1 ∙ 23 + 1 ∙ 22 + 0 ∙ 21 + 1 ∙ 20 + 1 ∙ 2-1 + 1 ∙ 2-2
Numbers DIGITAL DESIGN 101, University of California
Binary to Decimal Conversion
Multiply and Add
1101.112 = 1 ∙ 23 + 1 ∙ 22 + 0 ∙ 21 + 1 ∙ 20 + 1 ∙ 2-1 + 1 ∙ 2-2
= 8 + 4 + 0 + 1 + ½ + ¼ = 13.75
Numbers DIGITAL DESIGN 101, University of California
Decimal to Binary Conversion
Divide/multiply by 2 and concatenate remainders
13.7510 = 1101.112 = (1 ∙ 23 + 1 ∙ 22 + 0 ∙ 21 + 1 ∙ 20 ) + (1 ∙ 2-1 + 1 ∙ 2-2) = (1 ∙ 23 + 1 ∙ 22 + 0 ∙ 21 + 1 ∙ 20 ) + (1 ∙ 2-1 + 1 ∙ 2-2) 13.7510 : 2 = 6 + 1
6.75 : 2 = 3 + 0
3.75 : 2 = 1 + 1 1.75 : 2 = 0 + 1
- 0.75 x 2 = 1 + 0.5
0.5 x 2 = 1 + 0.0
Numbers DIGITAL DESIGN 101, University of California
Floating-Point Review
General form
+/- mantissa × (radix)exponent
32-bit standard
Sign: 0 for + and 1 for – Exponent = characteristic – bias
where bias = (radixs/2 ) – 1 therefore, bias is (27-1=127) for 32-bit floating point binary number
Mantissa = 1.(normalized fraction)
Sign Excess-127 characteristic Normalized Fraction
1 9 31 Implied binary point
Numbers DIGITAL DESIGN 101, University of California
Floating-Point Binary to Decimal
Problem: Convert a 32-bit floating-point number to
decimal
1 01111100 10110000000000000000000 Procedure:
- 1. Determine sign, mantissa and exponent
- Sign = Negative
- Exponent = characteristic – bias = 011111002 -127 = 124 – 127 = -3
- Mantissa = 1.10112 = 1.687510
- 2. Result = mantissa × (radix)exponent = -1.10112 ×2-3 (-1.6875 ×2-3)
Sign Excess-127 characteristic Normalized Fraction
0 1 9 31 Implied binary point