不,这不会(我的理解)涉及整数除法或浮点舍入的问题。
And no, this does not (to my understanding) involve integer division or floating-point rounding issues.
我的确切code是:
static void Main(string[] args)
{
double power = (double)1.0 / (double)7.0;
double expBase = -128.0;
System.Console.WriteLine("sanity check: expected: -128 ^ 0.142857142857143 = -2. actual: " + expBase + " ^ " + power + " = " + Math.Pow(expBase, power));
System.Console.ReadLine();
}
的输出是:
完整性检查:预期:-128 ^ 0.142857142857143 = -2。实际:-128 ^ 0.14285
7142857143 = NaN的
sanity check: expected: -128 ^ 0.142857142857143 = -2. actual: -128 ^ 0.14285
7142857143 = NaN
目标框架此code为(根据溶液性质).NET Framework 4.0客户端配置文件。
The Target Framework for this code is (according to solution properties) .NET Framework 4.0 Client Profile.
奇怪的是我没有找到任何提及此畅游网络世界中。我是不是疯了服用药丸来了!?
Strangely I haven't found any mention of this anywhere on the Web. Am I taking crazy pills here!?
推荐答案
好像是完全按照规定的;从的Math.Pow()备注部分对战俘(X,Y)
;
Seems to be exactly as specified; from the Math.Pow() remarks section on Pow(x,y)
;
参数 X - LT; 0但不NegativeInfinity; y不是整数,NegativeInfinity,或PositiveInfinity时
Parameters x < 0 but not NegativeInfinity; y is not an integer, NegativeInfinity, or PositiveInfinity.
结果 - 为NaN
Result NaN
相关推荐
最新文章