l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2005 Jan 17 13:45

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] gcc questions: inline and -ffast-math
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] gcc questions: inline and -ffast-math

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

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

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)
      return 0;

   inline void function(void)
      printf("hello world\n");

if I use the -O3 or -finline-functions gcc options?


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
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.