RSS

Representing Real Numbers

05 Nov

In representing real numbers, computers are programmed to use Floating Point Representation. In floating point represnetation, the real number is stored as two seperate pieces of data, called the mantissa and exponent.

The mantissa holds the complete number without the point.

The exponent holds the amount of places the point needs to be moved to the left hand side to keep the original number.

Example:

What is the mantissa and exponent of 011010.01?

The mantissa would be: 01101001

The exponent would be: 6 (0110) as the decimal point needs to be moved 6 places until it gets to the far left-hand side.

=> 01101001 x2^0110

although it is not necessary to store the base 2 or the”x” sign as they will always be involved.

Accuracy in real numbers.

If the mantissa is onlt storing 8 bits for the whole number and the number is nore than 8 then some of the numbers after the point will have to be discarded, therefore the accuracy of the number will be decreased

Example:

Ifthe binary number is: 0110100.1001

it will have to be reduced to 0110100.1 as the mantissa can only hold 8 bits, decreasing the accuracy.

Range.

Increasing the range of the mantissa and exponent allows the number to have more accuracy and a larger range of numbers which it could be.

Representing Negative Numbers.

There are two ways to represent negative numbers. a theoretical way is called signed bit represtentation. This is when the computer would take the leftmost bit of the number and assign a positive or negative sign but this is not used as there is two values for zero. So two’s compliment represetation is used.

When using twos compliment, all the zeros in the binary number must be changed to a one and all the ones must be changed to a zero. Then a one is added on.

Example.

What is negative 5?

firstly what is 5 in binary? 0101-> 1010

1010

  +1

= 1011 -> negative 5

Advertisements
 
1 Comment

Posted by on November 5, 2011 in Computing

 

One response to “Representing Real Numbers

  1. forrestercomputing

    December 4, 2011 at 12:18

    Excellent post Rachelle, really clear. Good example too.

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: