我觉得应该是
printf("%.3e",变量名);
而不是
printf("%3e",变量名);
==================
MSDN 中有关printf打印格式串:
%[flags] [width] [.precision] [{h | l | I64 | L}]type
的描述,其中对[.precision]是这么说的:
The third optional field of the format specification is the precision specification.
(大义:格式规约中第三个选项段是关于小数的规则。)
==================
对于打印e, E类型的数据时,[.precision]选项的作用是:
The precision specifies the number of digits to be printed after the decimal point. The last printed digit is rounded.
(大义:该精度指定了打印小数点后的位数,之后的位数会被四舍五入)
Default precision is 6; if precision is 0 or the period (.) appears without a number following it, no decimal point is printed.
(大义:缺省情况下,该精度为6,如果精度值为0或者小数点后没有紧跟着数字,则不会打印小数部分)
==================
例:
#include
int main()
{
float b = 100000.55555f;
printf("%3e\n",b);
printf("%.3e\n",b);
return 0;
}
输出结果为:
1.000006e+005
1.000e+005