Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Numbers with a floating comma. Data types of FPU.

To improve the accuracy and as compact as possible arrange a real number in the computer memory were invented by a floating point number. In the high-order bits are written order. Size of the order number is known in advance (depending on the type of data) and takes up much less space than it would take the integer part.In the low-order bits are written mantissa - normalized exponential form of a number without a comma. Thus, within the point mantissa can be as "float", i.e. its location depends on the order number.But how to make that point to swim? This deals with the processor, that is the hardware. In many modern processors even have special instructions for operations on floating point numbers (but more on that later). Most computers are used is a floating point number (not fixed), because it allows you to save memory and get better accuracy.

Recall the algorithm for representing a real number in the computer's memory:

1. Transfer the number of P-ary to binary

2. Submit a binary number to a normalized exponential form

3. Order to calculate the offset number

4. Place a sign the order and the corresponding bits in the mantissa

In the representation of real numbers in the computer's memory a first step we did and got the binary representation of the integer and fractional part of the number 3.14:

3 = 11b

0,14 = 0,00100011 b

That is the number 3.14 to binary is:

3,14 = 11,00100011 b

Now convert this number to a normalized exponential form:

11,00100011 b = 1,100100011 b * 21

Now calculate the offset procedure (assuming storage order, we use 5 bits). Then the raw data:

PI = 1 (we have 2 to the power 1)

k = 5

SP = SP + 2k-1 - 1 + 1 25-1 = - 1 + 1 = 16 - 1 = 16

Write the sign of the number, order, and the corresponding bits in the mantissa:

Sign | order |Mantissa

0 |10000 |0010001100

As you can see in the mantissa we have two junior category - it's zero. These bits are not used by us, but if you wish we could use them and thus improve accuracy.

 


Date: 2015-01-29; view: 1163


<== previous page | next page ==>
File systems. Characteristics of files. | Work with the keyboard. The data buffer BIOS. Using MS DOS function.
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)