[LCP]Rounding questions

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Fri Sep 6 19:36:06 UTC 2002


> point, not only did everything look correct, but the return value
> suddenly changed to 29.84.  Deleting any one of the fprintf()'s
> caused the erroneous value to return.  It didn't matter which one I
> deleted.  All three had to be present for the return value to be
> correct.

It might be because of some optimization done by the compiler.
Which might include moving around fp values from an FPU register
to and from memory. On i386, FPU registers have better precision
that the memory they are stored in, so if you move something from
FPU to mem, then from mem to FPU, the value will have changed.
This *may* be (part of) the problem.

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20020906/a0b295ee/attachment.htm 


More information about the linuxCprogramming mailing list