Real Number representation or IEEE754 Standard in c

07 Sep 2022 Balmiki Mandal 0 C Programming

IEEE754 Standard Representation

How to Store float and double(real number) in the memory block real number means decimal number .so real number are stored in memory seprate  process name is IEEE754 Standard

 

IEEE754 Standard:

Float And Double Do not Depend upon the compiler it is a separate Standard name as IEEE754 Standard. so the Size of float and size of double depends upon the IEEE&54 standard.

Note: Real values or real data are not Compile with the compiler so it is compiled with Floating Coprocessor  and its's based on IEEE754 Standard

Here are the simple program to understand the bheviour

Printf("%d %d\n",sizeof(float),sizeof(double)); output:- 4 8
float f=23.5;
printf("%f %e %g\n",f,f,f);

Output: 23.500000 2.350000e+001 23.5

Note:

  • %f:-After the Data, it will print six Digit
  • %e:-This Is a formate Specifier it will print the data in standard Decimal Exponent Form
  • Standard Formate:- Digit.x^e4
  • %g:- This specifier for Scientific notation

Representation of Bit In IEE754 Standard 

  1. Most Significant Bit Indicates The Sign Bits
  2. The next 8 bits Represents Exponent Bits (In case of Double)
  3. Remaining 23 Bits (52 In case of double) are for the Significant Bit (Mentessa)

Step to get IEEE754 Representation for real number

Step1: to convert the real number into binary

float 23.7;

10111.1011

Step2: Convert The binary into Standard Binary Exponent Formate

             Bit.xe^y

Step3: Add or subtract the Exponent part with standard Bias no.

  • Float-3f
  • double-3ff

Note:

for Float IEEE754 Bias Number is 7f

for double IEEE754 bias number is 3ff

Step 04: Result of the third step put in Exponent part

Step 05: fill the Signig=ficant part with a significant bit left to right 

Step 06: put sign Bit 0 for positive, 1 for negative

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.