Skip to content

Computer Science · Ch 2 — Encoding Schemes and Number System

Conversion of a Number with Fractional Part

2.3.4

Conversion of a Number with Fractional Part

All the conversions so far dealt with whole numbers. Numbers with a fractional part need one extra set of techniques — and there are three cases to master.

(A) Decimal number with fractional part to another number system

For the fractional part, the method flips from division to multiplication:

  • Repeatedly multiply the fractional part by the base value b, noting the integer part produced at each step.
  • Continue until the fractional part becomes 0.
  • Read the noted integer parts from top to bottom — that is the converted fractional part. (This is why top-to-bottom: the first multiplication produces the digit closest to the point, i.e., the most significant fractional digit.)
  • If the fractional part never becomes 0 in successive multiplications, stop after about 10 multiplications; if the fractional part starts repeating, stop the calculation there.

Example 2.13 — Convert (0.25)10 to binary.

                          Integer part
0.25 x 2 = 0.50    →      0
0.50 x 2 = 1.00    →      1
Fractional part is now 0 — stop.

Top to bottom:  (0.25)10 = (0.01)2

Example 2.14 — Convert (0.675)10 to binary.

                          Integer part
0.675 x 2 = 1.350   →     1
0.350 x 2 = 0.700   →     0
0.700 x 2 = 1.400   →     1
0.400 x 2 = 0.800   →     0
0.800 x 2 = 1.600   →     1
0.600 x 2 = 1.200   →     1
0.200 x 2 = 0.400   →     0
The fraction .400 has appeared before (repeating) — stop.

Top to bottom:  (0.675)10 = (0.1010110)2

Example 2.15 — Convert (0.675)10 to octal.

                          Integer part
0.675 x 8 = 5.400   →     5
0.400 x 8 = 3.200   →     3
0.200 x 8 = 1.600   →     1
0.600 x 8 = 4.800   →     4
0.800 x 8 = 6.400   →     6
The fraction .400 is repeating — stop.

Top to bottom:  (0.675)10 = (0.53146)8

Example 2.16 — Convert (0.675)10 to hexadecimal.

                          Integer part
0.675 x 16 = 10.800  →    A   (hexadecimal symbol for 10)
0.800 x 16 = 12.800  →    C   (hexadecimal symbol for 12)
The fraction .800 is repeating — stop.

Top to bottom:  (0.675)10 = (0.AC)16

For a full number like 65.25, convert the integer part by repeated division and the fractional part by repeated multiplication, then join the two results around the point.

Activity 2.5: write the binary representation of the following numbers: (i) (F018)16 (ii) (172)16 (iii) (613)8.

(B) Non-decimal number with fractional part to decimal

Use positional values, exactly as in Section 2.3.2 — the fraction digits simply take negative powers of the base. Compute the positional value of each digit and add the products.

Example 2.17 — Convert (100101.101)2 to decimal.

Digit            :  1    0    0    1    0    1  .  1     0     1
Positional value : 2^5  2^4  2^3  2^2  2^1  2^0   2^-1  2^-2  2^-3

Integer part  : 32 + 0 + 0 + 4 + 0 + 1        = 37
Fraction part : 0.5 + 0 + 0.125               = 0.625

(100101.101)2 = (37.625)10

Example 2.18 — Convert (605.12)8 to decimal.

Digit            :  6    0    5   .  1     2
Positional value : 8^2  8^1  8^0    8^-1  8^-2

Integer part  : 6 x 64 + 0 x 8 + 5 x 1        = 384 + 0 + 5   = 389
Fraction part : 1 x (1/8) + 2 x (1/64)        = 0.125 + 0.03125 = 0.15625

(605.12)8 = (389.15625)10

(C) Fractional binary number to octal or hexadecimal

Grouping still works — with one twist in direction:

  • Integer part: make 3-bit (octal) or 4-bit (hexadecimal) groups from right to left, as before.
  • Fractional part: make the groups from left to right, starting at the point, and add 0s at the END of the fractional part to complete the last group.
  • Substitute each group by its octal/hexadecimal symbol.

Example 2.19 — Convert (10101100.01011)2 to octal.