Math.Pi constant is wrong

后端 未结 3 1434
悲哀的现实
悲哀的现实 2021-01-26 04:55

I\'m well aware that a Double has only so many bits of precision, but we should still try to achieve high accuracy if possible. So I certainly do not expect to see this in the o

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-26 05:24

    Copy and pasted from Math.cs in the .NET 4.0 Reference Source:

      public const double PI = 3.14159265358979323846;
      public const double E  = 2.7182818284590452354;
    

    No idea what you are looking at.

    It was reverse-engineered from a follow-up question that you looked at the auto-generated text that was created from the assembly metadata when you use the Go To Definition context menu item. Yes, the code that generates this text appears to use the default %f formatting on public double constant values. Quite rare btw, there are not a lot of public constants that are double in the .NET framework. You can file a feedback report at connect.microsoft.com

提交回复
热议问题