View Single Post
Re: using -ffast-math for bot
Old
  (#3)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: using -ffast-math for bot - 09-03-2022

The flag fast-math is breaking standard compliance regarding floating point calculations and some other mathematical operations. Basically you should get pretty close results regarding floating point numbers, but they will not be 100% correct. Depending on the code, this might not be a problem.

Other thing which is disabled are traps(unix/linux) and async exceptions(Windows) when you try to do some architecture specific invalid math operation like division by zero. In that case the program will directly crash(you will not be able to trap/catch the signal). So it really depends on your code and use cases.

About -O3. This optimization flag does not break the compliance, on the contrary it will follow it more strictly regarding undefined behavior stuff. I.e. if your code is well written and does not rely on undefined behavior working in "specific" way then you will get a free performance boost. However, in large codebases that do not use linters and high warning levels, this is usually not the case so it may seems like -O3 is breaking your code.
  
Reply With Quote