Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   storing integer in processor (http://www.go4expert.com/forums/storing-integer-processor-t10552/)

kamlesh.m 12May2008 16:58

storing integer in processor
 
Hello Guys and gals

I have a strange question

When I write
int x= 4;
The datatype x gets stored in 32 bit compiler in the format 0x000 0100 which is basically a binary format.

but if I use
float y= 0.7;
The datatype as usual should be stored in a binary format.
but if we convert 0.7 to binary the procedure is as follows

0.7*2 = 1.4;
0.4*2= 0.8;
0.8*2 = 1.6;
0.6*2 = 1.2;
0.2*2 = 0.4;
0.4*2 = 0.8;
.
.
.
.
.
.
.
.


which goes in a never ending loop
So the binary format (user level) of integer y is 0.10110........
I just want to know the compiler representation of the above number.


All times are GMT +5.5. The time now is 15:10.