GCC equivalent to VC's floating point model switch?
Asked Answered
S

1

11

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?

Spleeny answered 15/7, 2010 at 14:39 Comment(0)
E
10

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.

Engulf answered 15/7, 2010 at 14:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.