Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC equivalent to VC's floating point model switch?

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?

like image 976
uj2 Avatar asked Jul 15 '10 14:07

uj2


1 Answers

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.

like image 76
Matthew Flaschen Avatar answered Jan 03 '23 12:01

Matthew Flaschen