a double has a higher precision than float i.e. it has larger number of bits for the mantisa part..... when float is compared to double it is promoted to double by filling remaining bits in mantissa with 0. consider this code....
http://ideone.com/y1Ahu <http://ideone.com/y1Ahu>Its equal bcoz the higher bits will be 0 for both double and float..... similar result occurs for 0.25 0.75 0.10 etc,,,,,. On Sat, Aug 6, 2011 at 10:26 AM, sagar pareek <[email protected]> wrote: > @saurabh > > what? i didnt get you > > > On Sat, Aug 6, 2011 at 10:22 AM, saurabh singh <[email protected]>wrote: > >> IEEE notation...... >> they appear to be the same but they are not same......0.5d has higher >> precision that does not necessarily means its larger...... >> >> >> On Sat, Aug 6, 2011 at 10:20 AM, sagar pareek <[email protected]>wrote: >> >>> see what piyush posted.... >>> >>> >>> On Sat, Aug 6, 2011 at 4:35 AM, Shashank Jain <[email protected]>wrote: >>> >>>> sagar - i dint get u, d code thing! >>>> >>>> Shashank Jain >>>> IIIrd year >>>> Computer Engineering >>>> Delhi College of Engineering >>>> >>>> >>>> >>>> On Sat, Aug 6, 2011 at 2:31 AM, sagar pareek <[email protected]>wrote: >>>> >>>>> yup exactly >>>>> >>>>> On Sat, Aug 6, 2011 at 1:51 AM, Piyush Kapoor <[email protected]>wrote: >>>>> >>>>>> I think it is because the numbers like 0.7 do not have a exact binary >>>>>> representation,so they are not exactly represented in float,while the >>>>>> constant is internally implemented as double.,Read this:: >>>>>> http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=integersReals >>>>>> >>>>>> >>>>>> -- >>>>>> *Regards,* >>>>>> *Piyush Kapoor,* >>>>>> *2nd year,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 [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> **Regards >>>>> SAGAR PAREEK >>>>> COMPUTER SCIENCE AND ENGINEERING >>>>> NIT ALLAHABAD >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> 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 [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> **Regards >>> SAGAR PAREEK >>> COMPUTER SCIENCE AND ENGINEERING >>> NIT ALLAHABAD >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> Saurabh Singh >> B.Tech (Computer Science) >> MNNIT ALLAHABAD >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > **Regards > SAGAR PAREEK > COMPUTER SCIENCE AND ENGINEERING > NIT ALLAHABAD > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
