So, you thought binary was just for whole numbers, did you? Wrong! It turns out computers can also get their digital teeth into fractions – those bits of numbers that aren't quite whole. This is where something called fixed point binary comes into play. It's a way of drawing a line in the digital sand (or rather, a point in the binary string) to separate the whole number part from the fractional bit. Clever, eh?
Think of it like this: you've got your usual binary numbers marching along, and then, suddenly, there's a binary point. Everything to the left of that point is the normal whole number bit. But everything to the right? That's where the fractions live. The first digit after the point represents 2-1 (which is a half in our regular numbers), the next one is 2-2 (a quarter), then 2-3 (an eighth), and so on, getting smaller and smaller as you go further to the right. It's like a digital shrinking ray for fractions!
Now, if you've got a fixed point binary number and you want to know what it means in our regular denary (or decimal) system, there's a little process to follow. They've even given us a handy way to organise it: a table! Let's have a squint at that:
| × 23 | × 22 | × 21 | × 20 | . | × 2-1 | × 2-2 |
See how that point separates the powers of 2? On the left, you've got the usual positive powers (like 20 which is 1, 21 which is 2, and so on). But on the right, after the dot, the powers become negative. That 2-1 is like saying ½, and 2-2 is like 1/22 = ¼, and so on. It's all about those inverse powers!
Convert the fixed point number 101.11 to denary.
Step 1 and Step 2: write the bits in a table and calculate each multiplication (see table).
| 1 | 0 | 1 | . | 1 | 1 |
| × 22 | × 21 | × 20 | . | × 2-1 | × 2-2 |
| 4 | 0 | 1 | . | 0.5 | 0.25 |
Step 3: add the results. Answer: 4 + 0 + 1 + 0.5 + 0.25 = 5.75
So, the digital overlords now want you to go the other way – take our perfectly sensible denary numbers and cram them into the world of fixed point binary. It's like trying to fit a particularly awkward octopus into a very specific jam jar.
If you're dealing with the nice, well-behaved whole number part of your denary number, the process is pretty much what you'd expect. You just keep dividing by 2 and noting down the remainders (those 0s and 1s) until you hit zero. Then you read the remainders in reverse, and Bob's your uncle – the whole number bit is sorted.
But then you've got those pesky fractions after the decimal point. They don't behave so nicely. To convert them, you have to get into a multiplying mood. You take the fractional part and keep multiplying it by 2. Each time you do this, you look at the bit that pops up *before* the decimal point (it will be either a 0 or a 1). You write these down, from top to bottom, and that's your fractional part in binary. You keep going until you hopefully end up with exactly 1.0. Sometimes, though, these fractions can be a bit stubborn and never quite reach 1.0, meaning you might have to stop after a reasonable number of steps. It's a bit like chasing a digital greased pig!
Convert the denary number 25.625 to fixed point.
Step 1: write the binary for 25 = 11001.
Step 2: multiply the fractional part (0.625) by 2:
0.625 × 2 = 1.25 (integer part: 1)
Then multiply the fractional part (0.25) by 2: 0.25 × 2 = 0.5 (integer part: 0)
Continue multiplying the fractional part by 2: 0.5 × 2 = 1.0 (integer part: 1)
Step 3: write the binary for the fraction (top to bottom): 101
So the answer is 11001.101
Step 1: Copy the table and write the bits in the first row. The first two have been done for you.
| 0 | 1 | 1 | 0 | . | 1 | 1 |
| × 23 | × 22 | × 21 | × 20 | . | × 2-1 | × 2-2 |
| 0 | 4 | . |
Step 2: Write the results of each multiplication. The first two have been done for you.
0 + 4 + 2 + 0 . 0.5 + 0.25
Step 3: Add the results.
Answer: 6.75
Step 1: Copy the table and write the bits in the first row.
| 1 | 0 | 0 | 1 | 1 | . | 1 | 0 | 1 | 0 |
| × 24 | × 23 | × 22 | × 21 | × 20 | . | × 2-1 | × 2-2 | × 2-3 | × 2-4 |
| . |
Step 2: Write the results of each multiplication in the third row of the table.
Step 3: Add the results.
Answer: 19.625
Step 1: Write the binary for 13.
1310 = ____
Step 2: Multiply the fractional part (0.625) by 2:
0.625 × 2 = 1.25
Then multiply the fractional part of the result by 2:
0.25 × 2 = 0.50
Then multiply the fractional part of the result by 2:
0.50 × 2 = 1.00
Then multiply the fractional part of the result by 2:
0 × 2 = 0.00
Step 3: Write the binary for the fraction (top to bottom of the integer parts of the results):
The binary for the fraction is: ____
The answer is: 1101.1010
Step 1: Write the binary for 6.
610 = ____
Step 2: Multiply the fractional part (0.8125) by 2:
0.8125 × 2 = ____
Then multiply the fractional part of the result by 2:
____ × 2 = ____
Then multiply the fractional part of the result by 2:
____ × 2 = ____
Then multiply the fractional part of the result by 2:
____ × 2 = ____
Step 3: Write the binary for the fraction (top to bottom of the integer parts of the results):
The binary for the fraction is: ____
The answer is: 0110.1101
Answers