News for hackers. Stuff that matters.
Re:GCC optimized code gives strange floating point results by brucedawson on Monday February 27, 2017 @02:00AM (#13742421)
> identical operations on identical inputs resulted > in different outputs due to the residual state.

What? What residual state? Floating-point math is tricky, but on a particular machine/compiler/compile-options set you should expect that identical operations on identical inputs should give identical results.

What is this "residual state" you mention?

If you have an FPU that lets you change precision or rounding modes then you can get different results from the same operations - is that what you're talking about?

I get frustrated when people think that floating-point just randomly changes bits for no reason. It doesn't. It randomly changes bits for specific reasons, which can be understood.

Re:GCC optimized code gives strange floating point results by effie on Tuesday February 28, 2017 @06:17PM (#13759220)
trelliscoded probably meant bits in scratchpad, which are not accessible to the programmer. I read somewhere that those hidden bits may not be saved and regenerated properly as part of cpu resuming execution of the program (task switching). I do not know if that can happen, but even if not, achieving consistency on subsequent runs is quite difficult - apparently one has to make sure the program and all libraries it uses were compiled with special compiler flags that prevent data alignment influencing results of FPU operations.

https://software.intel.com/articles/consistency-of-floating-...