1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

storing integer in processor

Discussion in 'C' started by kamlesh.m, May 12, 2008.

  1. kamlesh.m

    kamlesh.m New Member

    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.

Share This Page