0
我在Windows 64位平台上为C/C++代码使用Code :: Blocks 12.11。我最近遇到了这个程序意想不到的结果。Code :: Blocks在使用long double时出现错误结果
#include <stdio.h>
int main()
{
long double number;
number = 1.1234567;
printf("%llf\n",number);
return 0;
}
它应该打印输出1.1234567,但它给-0.000000,我发现它总是给出错误的值,当我使用长双。此代码在ideone http://ideone.com/Opu8cy上正常工作,请告诉我是否有解决此问题的方法。
我正在使用** GCC 4.7 mingw编译器**。使用%Lf和数字= 1.1234567L后,我得到相同的-0.000000结果。我还添加了** - Wall -Wtratra -pedantic-errors **,现在它显示了几条警告消息'1。未知的转换类型字符'L'格式为[-Wformat]和2.格式太多的参数[-Wformat-extra-args]'添加std = c99后我得到正确的结果没有任何警告,任何人都可以告诉哪个c标准代码::块默认情况下如下。非常感谢您的建议** Sukminder **。 –
@AtulKumarVerma:看起来像mingw [长双倍的麻烦](http://stackoverflow.com/questions/1764350/conversion-specifier-of-long-double-in-c) – Runium