测试程序如下:
#include "stdafx.h"
#include <iostream>
#include <cmath>
int main()
{
for(int i=0; i<32; i++)
{
double tmp = pow(10, i);
std::cout << tmp << std::endl;
}
return 0;
} VC6的输出结果如下:
1
10
100
1000
10000
100000
1e+006
1e+007
1e+008
1e+009
1e+010
1e+011
1e+012
1e+013
1e+014
1e+015
1e+016
1e+017
1e+018
1e+019
1e+020
1e+021
1e+022
1e+023
1e+024
1e+025
1e+026
1e+027
1e+028
1e+029
1e+030
1e+031 但是VC7.1(VS.NET 2003)
1
10
100
1000
10000
100000
1e+006
1e+007
1e+008
1e+009
1.41007e+009
1.21575e+009
-7.2738e+008
1.31613e+009
2.76447e+008
-1.53049e+009
1.87492e+009
1.56933e+009
-1.48662e+009
-1.98128e+009
1.66199e+009
-5.5994e+008
-1.30443e+009
-1.59384e+008
-1.59384e+009
1.24151e+009
-4.69762e+008
-4.02653e+008
2.68435e+008
-1.61061e+009
1.07374e+009
-2.14748e+009 是不是BUG?
#include "stdafx.h"
#include <iostream>
#include <cmath>
int main()
{
for(int i=0; i<32; i++)
{
double tmp = pow(10, i);
std::cout << tmp << std::endl;
}
return 0;
} VC6的输出结果如下:
1
10
100
1000
10000
100000
1e+006
1e+007
1e+008
1e+009
1e+010
1e+011
1e+012
1e+013
1e+014
1e+015
1e+016
1e+017
1e+018
1e+019
1e+020
1e+021
1e+022
1e+023
1e+024
1e+025
1e+026
1e+027
1e+028
1e+029
1e+030
1e+031 但是VC7.1(VS.NET 2003)
1
10
100
1000
10000
100000
1e+006
1e+007
1e+008
1e+009
1.41007e+009
1.21575e+009
-7.2738e+008
1.31613e+009
2.76447e+008
-1.53049e+009
1.87492e+009
1.56933e+009
-1.48662e+009
-1.98128e+009
1.66199e+009
-5.5994e+008
-1.30443e+009
-1.59384e+008
-1.59384e+009
1.24151e+009
-4.69762e+008
-4.02653e+008
2.68435e+008
-1.61061e+009
1.07374e+009
-2.14748e+009 是不是BUG?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货