我正在尝试舍入 double 0.0045
。当我打电话...
echo round($theFloat, 3);
我得到 0.004,而不是预期响应的 0.005。
这是代码:
$increase = 1.1;
$previousPrice = round(0.11 / $increase, 2);
$nextPrice = round(0.11 * $increase, 2);
$afterCut = round(0.11 * 0.95, 6);
$willSend = $afterCut - $previousPrice;
echo round($willSend, 3);