binary equivalent of 5.2 is
101.0011001100110011001100110011(nonterminating)..

now it is actually stored in normalised frorm in 32 bits..
like this
<--1 bit for sign---><-----8 bits for exponent-----><--------23 bits for
fraction------>
this is from higher order byte to lower order for little endian..

if no. is positive sign bit is 0 else it is 1

The rule says change your floating point no. in such a form that after 1st
digit that is 1 decimal point comes sooo
here it becomes like 1.0100110011001100110011001100110011(nonterminating) *
2^2

so i here get an exponent of 2 as 2 here.. now in exponent 8 bits this
exponent is stored as 127+exponent so here it becomes 10000001..

now fraction here is clearly value after the decimal point i.e.
01001100110011001100110011001100110011(non terminationg) but only 1st 23
bits are saved rest are left

so finally wht we get is:

11000000 10100110 01100110 01100110
(64)          (-90)         (102)        (102)


On Wed, Jul 13, 2011 at 2:49 PM, Piyush Kapoor <pkjee2...@gmail.com> wrote:

> why do we need a NthIntWithKBits() in this topic?
>
>
> On Tue, Jul 12, 2011 at 7:58 AM, oppilas . <jatka.oppimi...@gmail.com>wrote:
>
>>
>>
>> On Mon, Jul 11, 2011 at 5:54 PM, Piyush Kapoor <pkjee2...@gmail.com>wrote:
>>
>>> Can anybody give a full explanation
>>>
>>> http://ideone.com/K1QmV
>>
>>>  On Sat, Jul 9, 2011 at 10:49 PM, sunny agrawal <sunny816.i...@gmail.com
>>> > wrote:
>>>
>>>> try to find out the binary representation of float value 5.2
>>>>
>>>>
>>>> On Sat, Jul 9, 2011 at 10:46 PM, Sangeeta <sangeeta15...@gmail.com>wrote:
>>>>
>>>>> int main(){
>>>>> int i;
>>>>> float a=5.2;
>>>>> char *ptr;
>>>>> ptr=(char *)&a;
>>>>> for(i=0;i<=3;i++)
>>>>> printf("%d ",*ptr++);
>>>>> }
>>>>>
>>>>> output:
>>>>>  102 102 -90 64.explain?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Sunny Aggrawal
>>>> B-Tech IV year,CSI
>>>> Indian Institute Of Technology,Roorkee
>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> *Regards,*
>>> *Piyush Kapoor,*
>>> *CSE-IT-BHU*
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to