[vox-tech] gcc questions: inline and -ffast-math
Peter Jay Salzman
p at dirac.org
Mon Jan 17 07:45:56 PST 2005
Hi all,
I wrote some extremely numerically intensive code and went through a lot of
trouble to catch certain types of SIGFPE signals which are ignored by
default.
Given that, I'm interested in the -ffast-math gcc option. I feel that the
man page isn't giving me enough information to make a decision about whether
I want to use this compiler option or not.
On one hand, I need this program to run very fast because it can take
anywhere between 2 minutes and 2 weeks to finish a calculation on a fast
computer.
OTOH, I need the code to stop if anything becomes "NaN" or "inf". One "NaN"
or "inf" makes the whole calculation garbage, and that could be a waste of 2
weeks of computer time.
As an example, I have no idea what this means:
This option should never be turned on by any -O option since it can
result in incorrect output for programs which depend on an exact
implementation of IEEE or ISO rules/specifications for math functions.
I don't like the words "incorrect output", but I don't know what it means to
depend on an exact implementation of IEEE or ISO rules/specifications.
I see many programs use -ffast-math, but they're mostly games like scummvm
and quake2. I'm sure Guybrush Threepwood won't care if one of his polygons
is drawn incorrectly, but my stuff needs to be correct.
Anybody know what the above paragraph really means?
What are some of the "bad consequences" of using -ffast-math?
Second question: Is there any point in declaring functions as inline:
inline void function(void);
int main(void);
int main(void)
{
function();
return 0;
}
inline void function(void)
{
printf("hello world\n");
}
if I use the -O3 or -finline-functions gcc options?
Thanks,
Pete
--
The mathematics of physics has become ever more abstract, rather than more
complicated. The mind of God appears to be abstract but not complicated.
He also appears to like group theory. -- Tony Zee's "Fearful Symmetry"
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
More information about the vox-tech
mailing list