I have found some alternative code to set the floating-point precision:

         unsigned int fpu_cw;
         _controlfp_s(&fpu_cw, _PC_53, _MCW_PC);

Instead of _PC_53 I have also tried _PC_24 and _PC_64. But this didn't help. 
The two threads still behave differently.

-----Ursprüngliche Nachricht-----
Von: Burkhardt, Glenn B UTAS [mailto:glenn.burkha...@utas.utc.com] 
Gesendet: Dienstag, 1. März 2016 17:42
An: mingw-w64-public@lists.sourceforge.net
Betreff: [Mingw-w64-public] Floating-Point Operations Not Deterministic When 
Excecuted Asynchronously

You're probably running into the fact that Intel processors have floating point 
registers with 80 bits, and when optimization is turned on, operations are done 
in registers and not truncated as they are when the values are stored to memory.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323  Notice the number of 
duplicated reports - it's a surprise to a lot of people.

There are ways to set the precision used by the FPU, e.g.,

#include "fpu_control.h"

    fpu_control_t cw;
    _FPU_GETCW(cw);
    cw &= ~_FPU_EXTENDED;
    cw |= _FPU_DOUBLE;
    _FPU_SETCW(cw);


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + 
Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end 
web transactions and take corrective actions now Troubleshoot faster and 
improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to