yeah true . one interesting thing I noticed is that if you run this code

#include<stdio.h>
int main()
{
    int i = 0;
    do {
        printf ("%d\n",(float)1);
    }while(i++ < 1);
    return 0;
}

one would expect same output in both the rows but surprisingly it came
different for me every time .
any clues .. why ?




On Fri, Mar 1, 2013 at 12:05 PM, Karthikeyan V.B <kartmu...@gmail.com>wrote:

> O/p will not be 0.
>
> 1.000000 is the result which when read as %d takes the decimal value of
> <float 1.000000> stored in memory - it will not be 1.000000 or 0.
>
> Since float is not stored as direct binary in memory as integer is stored,
> instead there's a separate procedure for storing float as binary in memory
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Rohit Jangid
Graduate
Deptt. of Computer Engineering
NSIT, Delhi University, India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to