[cpp] std::cout 涓哄ꖕ鋥&# 8332;printf 髧鎻黦趸涓뒇

Xu Ziding xuziding at gmail.com
Mon Oct 29 11:26:50 CST 2007


代码如下:
	double d = 123456789e300;
	std::cout.precision(0);
	std::cout << std::fixed << d << std::endl;
	printf("%f\n", d );
我的VC7.1,DEBUG编译输出如下:
123456789000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000
123456789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000
RELEASE:
123456789000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000
123456789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000

为啥数大了之后,printf和流输出的值还不一样啊?而且debug和release的版本的输出也不一样呢?

                                          ZiDing

                                            10.29



More information about the Cpp mailing list