这段代码如何能输出如此大的数字?我已经在Ubuntu 14.04(gcc 4.8.2)上尝试过它,但在任何编译器上的MS Windows中都无法正常工作(即使是被称为“Windows版gcc”的MinGW)。为什么会这样?
#include <stdio.h>
#include <math.h>
int main()
{
printf("%.0f\n",pow(2,500));
}
Ubuntu输出:
3273390607896141870013189696827599152216642046043064789483291368096133796404
674554883270092325904157150886684127560071009217256545885393053328527589376
Windows 输出:
3273390607896141900000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
(The line break is added for clarity only.)