相关疑难解决方法(0)

Math.Pi常量是错误的

我很清楚Double只有很多精度,但是如果可能的话我们仍然应该尽量达到高精度.所以我当然不希望在官方的.NET 4系统库中看到这一点.

// Summary:
//     Represents the ratio of the circumference of a circle to its diameter,
//     specified by the constant, ?.
public const double PI = 3.14159;
Run Code Online (Sandbox Code Playgroud)

为什么只有6位数?使用准确的值会很容易且自由.我不是在.NET中做科学工作,但我确信其他人都做了,而且当Pi不准确时,他们会感到惊讶.同样适用于E.

编辑:这调整为关于Visual Studio中常量的反映.见 后续问题

.net math

0
推荐指数
1
解决办法
2174
查看次数

标签 统计

.net ×1

math ×1