This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

* Re: What is acceptable for -ffast-math? (Was: associative law incombine)



> Why not make this easier for the user:
> - default to non-IEEE, but "reasonably safe".

The default GCC behavior is not to allow any optimization
that could change the value of an expression.  That rule is easy
for users to understand and surely it is a good rule to keep.

Floating point arithmetic, IEEE or otherwise, does not obey the
associative or distributive laws.  To pretend otherwise, without
paying close attention, quickly leads to unexpected numerical
failures.  Currently the default is to prohibit associative law
"optimizations" of floating-point expressions, and it ought to stay
that way.


> - make "-ffast-math" mean exactly that: fast.

Historically fast-math has allowed some transformations that could
lose a bit of precision but not, for example, transformations that
could destroy all precision through cancellation error.  The addition
of one or more switch levels beyond fast-math retains a
"reasonably-safe speed" level and introduces a level of "break-neck
speed" that may be hazardous to your health.


> - "-mieee":

Associative law optimizations must ordinarily be disallowed even if
not IEEE.  The IEEE compliance switch implies further special features
like exception flags and numbers that are Not A Number.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]