【发布时间】:2013-03-21 18:48:16
【问题描述】:
代码:
float cordsStepAmountHeight;
float cordsStepAmountWidth;
coordStepAmountHeight=(2.0f/height);
coordStepAmountWidth=(2.0f/width);
其中宽度为 2560,高度为 1504(我设备的分辨率)。
经过计算,coordStepAmountHeight 的值为 0.0013297872 是正确的 但 cordsStepAmountWidth 以 7.8125E-4 的形式出现(当我认为它应该是 0.00078125 时)
为什么 coordStepAmountWidth 会这样出现?是否与声明为浮点数的变量无法处理计算或其他原因有关?
【问题讨论】:
标签: android floating-point division integer-division