Code is behaving differently in Release vs Debug Mode

后端 未结 6 1464
一向
一向 2020-12-19 03:52

We have some unit tests that fail when run in Release mode vs debug mode. If I attach a debugger in release mode the tests pass. There is way too much code to publish here s

6条回答
  •  一生所求
    2020-12-19 04:17

    Since it seems to be floating point related there are so many things that can go wrong. See: C# - Inconsistent math operation result on 32-bit and 64-bit and Double precision problems on .NET

    There are so many things that can be trashed with floating points. And comparing floats for equality is a general no-no. You chould check the difference smaller than a reasonably epsilon.

提交回复
热议问题