0
有没有使用指数精度进行打印的方法? 我需要填写了微小的数字的一些数据和比较后那些....指数精度[打印双倍,微小数字]
我有这样的:
(0) - Mesured estimatedTime for multithread in block: 1.4917951E16 s
(1) - Mesured estimatedTime for multithread in block: 7.531891E15 s
(2) - Mesured estimatedTime for multithread in block: 2.9287E13 s
(3) - Mesured estimatedTime for multithread in block: 3.28478435E17 s
(4) - Mesured estimatedTime for multithread in block: 6.038E12 s
,我想打印这样的:
(0) - Mesured estimatedTime for original in block: 0000.15595175E15 s
(1) - Mesured estimatedTime for original in block: 0007.335638E15 s
(2) - Mesured estimatedTime for original in block: 0416.66E15 s
(3) - Mesured estimatedTime for original in block: 0000.0390156852E15 s
(4) - Mesured estimatedTime for original in block: 6642.0E15 s
我知道你可以这样强制:
// Force minimum number of digits to left and right of decimal point
formatter = new DecimalFormat("0.0E0");
s = formatter.format(-1234.567); // -1.2E3
但不知道如何我可以强迫它Exp o-Precision:((((( help !!) :/
非常感谢! :-)整个早上都在找这个! :** s2 –
printf是最简单的格式,但可能不是您想要的。例如,我怀疑'1'会变成'1e-15e15';)希望你明白了,可以使用DecimalFormat或其他来满足你的需求。 –
Peter Lawrey你知道如果使用DecimalFormat的任何方式吗?我没有找到任何这些proupose ...该printf解决我的问题,但我不是最好的解决方案..对不对? –