- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

To represent fractions may be necessary quite often inside the 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.

Unsigned fractions 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.

Let us discuss on 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 is 2^{(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 |
---|---|

4 | ±0.125 |

8 | ±0.0078125 |

16 | ±0.0000305 |

32 | ±0.5 × 10^{-9} |

The minimum word size has to be 8 bits to represent the number -0.0123 somewhat accurately. The accuracy is very much improved if the word size is further increased.

- Related Questions & Answers
- Find the Sum of fractions - JavaScript
- Representation of Graphs
- Python Rational numbers (fractions)
- Unique Fractions in C++
- Simplified Fractions in C++
- Matrix Representation of Graphs
- 2's complement fractions
- Representation of Relations using Graph
- Array Representation Of Binary Heap
- C Program to add two fractions
- Product of given N fractions in reduced form in C
- Representation of class hierarchy in DBMS
- String representation of Boolean in Java
- Program to compare two fractions in C
- Function that finds the simplest form of summed fractions in JavaScript

Advertisements