Does GCC have an equivalent compiler switch to VC's floating point model switch (/fp
)?
In particular, my application benefits from compiling with /fp:fast
and precision is not a big deal, how should I compile it with GCC?
Does GCC have an equivalent compiler switch to VC's floating point model switch (/fp
)?
In particular, my application benefits from compiling with /fp:fast
and precision is not a big deal, how should I compile it with GCC?
Try -ffast-math
. On gcc 4.4.1, this turns on:
-fno-math-errno
- Don't set errno for single instruction math functions.-funsafe-math-optimizations
- Assume arguments and result of math operations are valid, and potentially violate standards-ffinite-math-only
- Assume arguments and results are finite.-fno-rounding-math
- Enable optimizations that assume default rounding. This is the default, but it could be overridden by something else.-fno-signaling-nans
- Enable optimizations that can change number of math exceptions.; also default-fcx-limited-range
- Assume range reduction is not needed for complex number division:__FAST_MATH__
macro.You could also enable these individually.