c ++ pow函数 - 无效结果? [英] c++ pow function- invalid result?
本文介绍了c ++ pow函数 - 无效结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么dResult的输出无效?
Env:Visual Studio 2008
Why is the output of the dResult invalid ?
Env: Visual Studio 2008
int _tmain(int argc, _TCHAR* argv[])
{
double dN = - 0.091023604111478473 ;
double dD = 0.127777777777777;
double dResult = pow( dN,dD );
//dResult = -1.#IND000000000000
return 0;
}
推荐答案
请参阅http://www.cplusplus.com/reference/clibrary/cmath/pow/
double pow (double base, double exponent );
如果base为负数,指数不是整数值,否定,发生域错误,将全局变量errno设置为值EDOM。
"If base is negative and exponent is not an integral value, or if base is zero and exponent is negative, a domain error occurs, setting the global variable errno to the value EDOM."
这篇关于c ++ pow函数 - 无效结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文