On Fri, 12 Mar 2021 at 12:36, David Aldrich via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > Hi > > We have observed that the results of some floating point calculations > change when compiler flag: > > -march=native > > is used. This can happen even for relatively simple expressions such as: > > x*x+y*y > > where x and y are double precision. The observed difference is in the least > significant bit of the mantissa, which suggests a rounding issue. Is this > expected behaviour? > > Is it because the FPU uses 80-bit extended precision for intermediate > results whereas the AVX hardware does not? Yes. It's probably the SSE registers rather than AVX, but you didn't tell us what hardware you're using so we don't know what the defaults are without -march=native. See https://gcc.gnu.org/wiki/FAQ#PR323 You can use -mfpmath=sse to always use the SSE registers, but you should also read the descriptions of -fexcess-precision=standard and -ffloat-store in the manual.