On Fri, 17 Jul 2009 19:51:47 +0200 Szabolcs Nagy <nszabo...@gmail.com> wrote:
> my problem was that it seems that c and ieee754 does not even require > that the arithmetic operations are well defined: same operation on > same numbers with same type does not necessary give the same result > (even on same architecture with same compiler) > > for example > (double)atoi("1")/atoi("3") == (double)atoi("1")/atoi("3") > gives false with gcc on my x86 machine eventhough the two expressions > are semantically equivalent > Yes. Because you are working with floats... 4/2 can equal 1.99999999999999967584 in float. depending on implementation. It is not C specific. I have seen this for FORTRAN and other languages too.