- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
2's complement fractions
As an example, the value of 1 001, if the interpretation is that it is a 2's complement fraction will be as follows -It is 1.001 assuming the binary point after the MS bit. As the MS bit is 1, it is a negative number. Then the remaining bits do not specify the magnitude directly. The 2's complement of 1 001 is 0110+ 1 = 0 111. This is a positive fraction with the value 1 × 2−1 +1 × 2−2 +1 × 2−3 = 0.5 + 0.25 + 0.125 = 0.875 decimal. Thus, -0.875 is the value of 1001.
If the word size is n bits, the smallest magnitude non-zero fraction that can be represented is2(n-1).A table of word size and the smallest magnitude fraction that can be represented as shown in the following.
|Word size||Smallest magnitude 2 's complement fraction|
| 32||±0.5 × 10−9|
The minimum word size has to be 8bits to represent the number -0.0123 somewhat accurately. The accuracy is very much improved if the word size is further increased.
To have a generic discussion on the representation of fractions, we can mention that to represent fractions may be necessary quite often inside a computer. For example, it may be needed to represent inside a computer a value like +0.610 or -0.610. To represent signed fractions, it is necessary to assume the binary point just after the MSB in the bit sequence. Such numbers where the binary point is assumed to be at a fixed position in the bit sequence are called fixed-point numbers.
Unsignedfractions will have the assumed binary point at the extreme left. SM,1's complement, and 2's complement fractions will have this imaginary binary point just to the right of the MS bit.
If the imaginary point is at the extreme right, then the number is an integer. If the imaginary binary point is at the extreme left for an unsigned number, the number is an unsigned fraction. If the binary point is to the immediate right of the MS bit, the number is a signed fraction. If the binary point is in the middle of a bit sequence, the number has an integer and a fractional part.
- 1's Complement vs 2's Complement
- 2's complement notation
- 1’s and 2’s complement of a Binary Number?
- One’s Complement
- Two’s Complement
- 1's complement notation
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find 1's and 2's complement of 16-bit number
- 8085 program to find 2's complement of the contents of Flag Register
- Draw a Turing machine to find 2’s complement of a binary number
- 10’s Complement of a decimal number?
- Representation of fractions
- Find One’s Complement of an Integer in C++
- Previous number same as 1’s complement in C++
- Python Rational numbers (fractions)