64位log10(double)返回10的幂的错误值 [英] 64-bit log10(double) returns wrong values for powers of 10
问题描述
还有其他人看到过这个问题吗?我们有一个基于.Net 2.0的应用程序,该应用程序包含用非托管C ++编写的ActiveX控件,并且看到了在32位Windows上正确运行但在64位Windows上错误运行的情况.我将其跟踪到C ++模块中对log10(double)的调用.有时(在某些情况下,重复)在64位Windows上,log10(1000000.0)返回5.9999999999999991而不是6.0,而log10(10000000.0)返回6.9999999999999991而不是7.0!上下文会触发错误,但它是完全一致的.我们正在使用Visual Studio2008.
Jon
Has anyone else seen this problem? We have a .Net 2.0-based application that includes ActiveX controls written in unmanaged C++, and have seen cases that work correctly on 32-bit Windows, but incorrectly on 64-bit Windows. I tracked it down to a call to log10(double) in a C++ module. Sometimes (repeatably, in certain contexts), on 64-bit Windows, log10(1000000.0) returns 5.9999999999999991 instead of 6.0, and log10(10000000.0) returns 6.9999999999999991 instead of 7.0!
I can't tell specifically what about the context triggers the error, but it is completely consistent. We're using Visual Studio 2008.
Jon
推荐答案
这篇关于64位log10(double)返回10的幂的错误值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!