0throot <0throot@xxxxxxxxxxx> writes: > In one of my programs, I found a wierd problem with float multiplication. Any > insights you can provide will be very helpful. > > The program is as follows, > > #include <stdio.h> > int main(void) { float a=4097, b=4097, c=0; c=a*b; printf("%12.2f != %d\n", > c, 4097*4097); return 0; } > > The output i get is, > > 16785408.00 != 16785409 > > I never thought using float over int could have such adverse effects. > > Is this the correct behavior ? or am i doing something wrong here ? http://docs.sun.com/source/806-3568/ncg_goldberg.html Ian