Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22118

how to use the gcc preprocessor macro __FAST_MATH__?

$
0
0

man gcc(1) says: the option -ffast-math causes the preprocessor macro __FAST_MATH__ to be defined. Is there any further documentation of that macro?

I would expect that code like

#define __FAST_MATH__ blabla
y = pow(x,a);
#undef __FAST_MATH__

allows control of math optimization, fine grained down to single statements.

However, my tests rather indicate that

#define __FAST_MATH__
#define __FAST_MATH__ on

are all ignored, regardless where they are placed.

[EDIT] They are ignored even if they are placed before

#include <math.h>

"Ignored" means: have no measurable effect. Whereas -ffast-math accelerates my test code by a factor of 3.


Viewing all articles
Browse latest Browse all 22118

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>