[LCP]Rounding questions

Chuck Martin nrocinu at myrealbox.com
Wed Sep 11 12:01:11 UTC 2002


I believe I have found the perfect solution for my problems, one that
seems to have been tailor-made for problems such as this.  I have to
admit that I didn't come up with this solution on my own.  It was
suggested to me by Steve Baker (thanks, again, Steve), and I wanted to
share it with everyone else here, in case any of you comes up against
something similar in the future.

It seems that gcc (and possibly other compilers--I don't know) has a
command line option intended to deal with cases where the differing
precision between FPU registers and doubles in memory cause problems.
This option is -ffloat-store.  I've applied this option to the one file
that has had all of the problems (and undid some previous workarounds
that I wasn't completely happy with), and the problems were all cured,
including the rounding problem, even though I am now compiling all files
with optimization (-O2).

Thanks to everyone who made suggestions and observations, and especially
to Steve for finding the best and most appropriate solution.  This has
been a very interesting and enlightening discussion.

Chuck





More information about the linuxCprogramming mailing list