This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / Java问题:猜一猜 24.99 * 16,用double类型,结果是多少?399.8400000000001 !!!!!!!!
真是愚蠢到了极点。问题是:该怎么解决呢?
-bloor(不老);
2002-3-27
{78}
(#421442@0)
-
I guess 24.99 is a price. The type "double" doesn't guarantee acurate operations. In this case,
my solution is:write a class called "priceCalculation", and implement the multiply and division operations.
-kiwi(kiwi);
2002-3-27
{94}
(#421489@0)
-
use Java "Format" could output the format you wanted.
-mimi888(老猫钓鱼);
2002-3-27
(#421536@0)