Negative and Fractional number representation

               Negative and Fractional Number                                      Representation


What are Rational Numbers?

Rational numbers are numbers that can be expressed as the quotient of two integers, where the denominator is not zero. For example, 34\frac{3}{4} and 52-\frac{5}{2} are rational numbers.

Negative Rational Numbers

Negative rational numbers are rational numbers that are less than zero. They can be represented as the quotient of two integers where either the numerator or the denominator is negative, but not both. For example:

  • -3/8-\frac{3}{4}

  • -9/5
  • Representation of negative rational numbers on a number line is very similar to the representation of negative integers or negative fractions on a number line. The left-hand side of 0 on a number line represents the negative region and the right-hand side of 0 represents the positive region.




Representation on a Number Line



Negative rational numbers can be represented on a number line. If we take zero as the central point, positive rational numbers lie to the right of zero, and negative rational numbers lie to the left. The further left a negative rational number is, the smaller its value.

For instance:

  • 12-\frac{1}{2} is to the left of zero.

  • 1-1 is further left than 12-\frac{1}{2}.

So we can see that fractional binary numbers, that is binary numbers that have a weighting of less than 1 (20), can be converted into their decimal number equivalent by successively dividing the binary weighting factor by the value of two for each decrease in the power of 2, remembering also that 20 is equal to 1, and ...

The simplest is to simply use the leftmost digit of the number as a special value to represent the sign of the number: 0 = positive, 1 = negative. For example, a value of positive 12 (decimal) would be written as 01100 in binary, but negative 12 (decimal) would be written as 11100.








Negative Numbers in Binary

Negative numbers can be represented in binary using several methods, but the most common one is Two's Complement. Here's how it works:

  1. Positive to Binary: Start with the binary representation of the positive version of the number.

  2. Invert the Bits: Change all 0s to 1s and all 1s to 0s (this is called the One's Complement).

  3. Add One: Add 1 to the result from step 2.

For example, to represent -5 in an 8-bit system:

  1. Positive 5 in binary is 00000101.

  2. Inverting the bits gives 11111010.

  3. Adding 1 gives 11111011.

So, 11111011 is the two's complement representation of -5.

Fractional Numbers in Binary

Fractional numbers can be represented in binary using a method similar to decimal fractions:

  • The part before the binary point (like the decimal point) is handled as an integer.

  • The part after the binary point represents fractions, where each position is a negative power of 2.

For example, let's represent 5.625 in binary:

  1. Whole Number Part: 5 in binary is 101.

  2. Fractional Part:

    • 0.625 in binary:

      • 0.5 (2^-1) + 0.125 (2^-3)

      • So, 0.625 in binary is 0.101.

Combining these gives 101.101 for 5.625.

Negative Fractional Numbers

Combining both concepts:

  1. Positive Representation: Start with the binary representation of the positive number.

  2. Two's Complement: Apply the two's complement method to the entire number, including the fractional part.

For instance, to represent -5.625:

  1. Positive 5.625 in binary is 101.101.

  2. Invert the bits: 010.010.

  3. Add 1 to the least significant bit: 010.011.

Therefore, 11010.011 (as we have to consider enough bits for an 8-bit system or more) would be the two's complement representation of -5.625.


Negative Numbers in Binary

Negative numbers are often represented in binary using Two's Complement. Here's the process:

  1. Positive Binary Representation: Start with the binary representation of the positive version of the number.

  2. Invert the Bits: Change all 0s to 1s and all 1s to 0s (this is called the One's Complement).

  3. Add One: Add 1 to the result from step 2.

For example, to represent -7 in an 8-bit system:

  1. Positive 7 in binary is 00000111.

  2. Inverting the bits gives 11111000.

  3. Adding 1 gives 11111001.

So, 11111001 is the two's complement representation of -7.


 



Fractional Numbers in Binary

Fractional numbers in binary are represented using a method similar to decimal fractions:

  • The part before the binary point (like the decimal point) is handled as an integer.

  • The part after the binary point represents fractions, where each position is a negative power of 2.

For example, let's represent 6.375 in binary:

  1. Whole Number Part: 6 in binary is 110.

  2. Fractional Part:

    • 0.375 in binary:

      • 0.25 (2^-2) + 0.125 (2^-3)

      • So, 0.375 in binary is 0.011.

Combining these gives 110.011 for 6.375.

Negative Fractional Numbers

For negative fractional numbers, we combine both concepts:

  1. Positive Representation: Start with the binary representation of the positive number.

  2. Two's Complement: Apply the two's complement method to the entire number, including the fractional part.

For instance, to represent -6.375:

  1. Positive 6.375 in binary is 110.011.

  2. Invert the bits: 001.100.

  3. Add 1 to the least significant bit: 001.101.

Therefore, 11111001.101 (considering it in a larger bit system) would be the two's complement representation of -6.375.


SUMMERY

Negative numbers in binary are represented using the Two's Complement method, which involves inverting the bits of the positive binary representation and then adding one. Fractional numbers are represented in binary by converting the integer part to binary and the fractional part into a series of binary fractions, where each position is a negative power of 2. When it comes to negative fractional numbers, we combine both approaches by first converting the number to binary, then applying the Two's Complement method to the entire binary representation.









Comments

Popular posts from this blog

Parts of a Computer systems unit

How we access the website.