Can something in C# change float comparison behaviour at runtime? [x64]

前端 未结 3 1698
暗喜
暗喜 2021-02-05 04:21

I am experiencing a very weird problem with our test code in a commercial product under Windows 7 64 bit with VS 2012 .net 4.5 compiled as 64 bit.

The following test cod

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 05:18

    DirectX is known to modify the FPU settings. See this related question: Can floating-point precision be thread-dependent?

    You can either tell DirectX to preserve the FPU settings by specifying the D3DCREATE_FPU_PRESERVE flag when calling CreateDevice or execute your floating point code on a new thread.

提交回复
热议问题