I have following program:
#include <stdio.h>
int main(int args, char *argv[]) {
printf("%f\n", 0.99999);
printf("%e\n", 0.99999);
}
结果如下:
0.009990
9.999900e-001
为什么第一个数字是错误的?我使用Windows XP,编译器是“Logiciels Informatique lcc-win32版本3.8,编译日期为2012年11月30日19:38:03”。
#include <stdio.h>
(并仍然存在问题)的版本。确保你复制并粘贴整个程序。 - Keith Thompsonprintf()
的一个bug。 - chux - Reinstate Monica