Professional Documents
Culture Documents
1
◗ Fixed point numbers:
◦ Consists of integer and a fraction
2
◗ Example: Find the fixed-point number (01110.111)2 in
decimal
3
◗ Example: Find the fixed-point number (01110.111)2 in
decimal
◗ Together: (14.875)10
4
◗ Example: Convert the number (23.625)10 to fixed point
binary
5
◗ Example: Convert the number (23.625)10 to fixed point
binary
Numerator Denominator Quotient Remainder
◗ Left side: 23 2 11 1
11 2 5 1
5 2 2 1
2 2 1 0
1 2 0 1
◗ Right side:
◗ 0.625 x 2 = 1.25 (1 crossover)
◗ 0.25 x 2 = 0.5 (0 crossover)
◗ 0.5 x 2 = 1.0 (1 crossover)
◗ Together: (10111.101)2
6
◗ Fixed point number have a range that is limited by the
significant digits
◗ Sometimes its very important to have a big range and
accurate fraction part
◗ The IEEE standard for floating point
7
◗ We have two precisions
◦ Single 32- bit or double 64- bit
8
Find the Single precision representation of the number -118.625
9
◗ The exponent is biased by adding 127 so that the exponent
can be stored as magnitude only
◦ i.e. Exponents are stored in positive state
◦ For our example the final floating point representation is
• Represent –0.75 in Single Precision
12
• Represent –0.75 in Single Precision
1. Sign bit: s=1 (-ve)
2. 0.75 in binary: 0.11
3. Normalize: 1.1 x 2-1
4. Padding: 10000000000000000000000
5. e+127=-1+127=126=01111110
13
• Represent –0.75 in Double Precision
14
• Represent –0.75 in Double Precision
1. Sign bit: s=1 (-ve)
2. 0.75 in binary: 0.11
3. Normalize: 1.1 x 2-1
4. Padding:
100000000000000000000000000000
00000000000000000000000
5. e+1023=-1+1023=1022=
01111111110
15
Steps 1,2,3 are the same as single precision
• What number is represented by the single-
precision float
11000000101000…00
16
• What number is represented by the single-
precision float
11000000101000…00
1. Sign: -ve
2. 1000001=129=E
3. M=01
4. 1.Mx2E-127=1.01x22=(5.0) 10
5. N=-1.Mx2E-127=-1.01x22=(-5.0)10
17