I'd say : rounding errors. Floating point goes in mysterious ways.
On Tue, Jan 11, 2011 at 8:38 AM, ratheesh k <ratheesh.ksz@xxxxxxxxx> wrote:
> I could not understand why it getting printed like this. Could any
> body tell me.
>
> #include <stdio.h>
>
> int main()
> {
> float f=0.0f;
> int i;
>
> for(i=0;i<10;i++)
> f = f + 0.1f;
>
> if(f == 1.0f)
> printf("f is 1.0 \n");
> else
> printf("f is NOT 1.0\n");
>
> return 0;
> }
--
Uriel Corfa
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Assembler]
[Git]
[Kernel List]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[Yosemite Campsites]
[Yosemite News]
[GCC Help]