- In C, float and double will store using IEEE 754 standard in a memory location.
- Float – Called as a single precision real number (1 word = 4 bytes = 32 bit).
- Double – Called as a double precision real number (2 words = 8 bytes = 64bit).
- All real number’s process is done by small processor we call as a CPU.

**Table 1.** Three different type of bits to store flat and double.

- There are three parts of memory where float and double stored are there i.e.
**Sign, Exponent, Significant.**

**Steps to Convert real number data into memory :**

- Convert into binary.
- Convert that binary data into standard binary.

i.e. 1.xe-+y

Ex : 1010. 0101

= 1.0100101 e+3

3. Add or Subtract exponent part with standard bias number.

[ float – 7F, double – 3FF]

4. The result of 3rd step we have to put into exponent part.

5. Significant part is filled in significant part.

Now we will take one float and one double example :

**Float** f = 1;

Step 1. Binary of 1 = 0000 0000 0000 0001

Step 2. Standard binary = 1.0e0

Step 3. Add or subtract from bias number = 7F – 0 = 7F

Step 4. Final 1.0e0

2.**Float** f = 7.7

Step 1. Binary of 7.7 = 0111.10110

Step 2. Standard binary = 1.1110110e+2

Step 3. Add or subtract from bias number = 7F + 2= 81 <—this is hex number

Step 4. Final 1.1110110e+2

Now we will do the same thing for double :

- Double d = 23.5 (remember double is a 64bit wide).

### Like this:

Like Loading...

*Related*

## Leave a Reply