Can anyone explain this strange behavior with signed floats in C#?

前端 未结 11 1987
别跟我提以往
别跟我提以往 2020-12-07 07:17

Here is the example with comments:

class Program
{
    // first version of structure
    public struct D1
    {
        public double d;
        public int f         


        
11条回答
  •  囚心锁ツ
    2020-12-07 07:42

    It must be zero related, since changing the line

    d.d = -0.0

    to:

    d.d = 0.0

    results in the comparison being true...

提交回复
热议问题