3 ms·
> identical operations on identical inputs resulted > in different outputs due to the residual state. What? What residual state? Floating-point math is tricky,
by brucedawson 10y ago
> 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.
- effie 10y agotrelliscoded 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-point-results-using-the-intel-compiler/ https://software.intel.com/articles/consistency-of-floating-...