Difference between revisions of "Fixed Point Numbers"
(→Revision) |
(→Overview) |
||
(20 intermediate revisions by 5 users not shown) | |||
Line 26: | Line 26: | ||
=Revision= | =Revision= | ||
− | + | ||
<quiz display=simple> | <quiz display=simple> | ||
− | |||
What is the correct binary for the number 15.375? | What is the correct binary for the number 15.375? | ||
| type="()" } | | type="()" } | ||
+ 1111.0110 | + 1111.0110 | ||
+ | || 1111 = 15 0'''1'''10 = 0.25 01'''1'''0 = 0.0625 0.25 + 0.0625 = 0.3125 | ||
- 1101.1010 | - 1101.1010 | ||
+ | || 1101 = 13 '''1'''010 = 0.5 10'''1'''0 = 0.125 0.5 + 0.125 = 0.625 | ||
- 1001.1001 | - 1001.1001 | ||
− | - 0111.1011 | + | || 1001 = 9 '''1'''001 = 0.5 100'''1''' = 0.0625 0.25 + 0.0625 = 0.5625 |
+ | - 0111.1011 | ||
+ | || 0111 = 7 '''1'''011 = 0.5 10'''1'''1 = 0.125 101'''1''' = 0.0625 0.5 + 0.125 + 0.0625 = 0.6875 | ||
− | { What is the correct binary for the number 13. | + | { What is the correct binary for the number 13.1875? |
| type="()" } | | type="()" } | ||
- 1111.0101 | - 1111.0101 | ||
+ | || 1111 = 15 .0101 = 0.3125 | ||
- 1011.1111 | - 1011.1111 | ||
+ | || 1011 = 11 .1111 = 0.9375 | ||
- 1010.0111 | - 1010.0111 | ||
+ | || 1010 = 10 .0111 = 0.4375 | ||
+ 1101.0011 | + 1101.0011 | ||
+ | || 1101 = 13 .0011 = 0.1875 | ||
− | + | { Convert 7.78125 into binary. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | { Convert 7. | ||
|type="()"} | |type="()"} | ||
- 111.01100 | - 111.01100 | ||
+ | || 111 = 7 .01100 = 0.375 | ||
+ 111.11001 | + 111.11001 | ||
+ | || 111 = 7 .11001 = 0.78125 | ||
- 100.01001 | - 100.01001 | ||
+ | || 100 = 4 .01001 = 0.28125 | ||
- 101.01101 | - 101.01101 | ||
+ | || 101 = 5 .01101 = 0.40625 | ||
+ | |||
+ | { convert 1111.1010 into denary | ||
+ | |type="()"} | ||
+ | + 15.625 | ||
+ | || 15 = 1111 .625 = 1010 | ||
+ | - 11.375 | ||
+ | || 11 = 1011 .375 = 0110 | ||
+ | - 13.725 | ||
+ | || 13 = 1101 .725 = 1011 | ||
+ | - 10.855 | ||
+ | || 10 = 1010 .855 = 1101 | ||
+ | |||
+ | { What is the correct binary for the number 10.5 | ||
+ | | type="()" } | ||
+ | - 0110.0001 | ||
+ | - 0101.1101 | ||
+ | + 1010.1000 | ||
+ | - 1110.1001 | ||
+ | |||
+ | { What is 0101.0101 in denary ? | ||
+ | | type="()" } | ||
+ | + 5.3125 | ||
+ | - 12.9678 | ||
+ | - 7.8665 | ||
+ | - 3.3455 | ||
+ | || Denary is the standard number system | ||
+ | |||
+ | { Is 0011.1000, 3.5 in Denary ? | ||
+ | | type="()" } | ||
+ | + Yes | ||
+ | - No | ||
+ | |||
</quiz> | </quiz> |
Latest revision as of 08:27, 25 September 2020
The Binary Point
Fixed Point numbers are a straightforward and simple approach to express Fractional numbers, utilizing a Fixed Number of bits.
The expression "Fixed Point" alludes to the position of the Binary Point. The Binary Point is similar to the Decimal Point of a base-ten number, however since this is Binary as opposed to Decimal, an alternate term is utilized. In Binary, bits can be either 0 or 1 and there is no different image to assign where the Binary Point lies. Be that as it may, we envision, or accept, that the Binary Point lives at a Fixed area between assigned bits in the number.
For example, in a 32-bit number, we can expect that the Binary Point exists specifically between bits 15 (15 in light of the fact that the primary piece is numbered 0, not 1) and 16, giving 16 bits for the Whole number part and 16 bits for the Fractional part. Note that the most significant bit in the whole number field is generally designated as the sign bit leaving 15 bits for the whole number's magnitude.
Place Value Method
Not all numbers can be represented exactly by a fixed-point number, and so the closest approximation is used.
In the above example the number stored would be :
32 + 8 + 2 + 1 + 0.25 + 0.03125 + 0.0078125 + 0.00390625 = 43.2869375
Repeated Multiplication
You can convert any decimal fraction to a binary fraction. Multiply the fractional part of the number by 2. Take the integer part of the result (1 or 0) as the first bit. Repeat this process with the result until you run out of patience. For example, to convert 0.3568 into fixed point binary with 8 bits to the right of the binary point,
0.3568 is .01011011