double を丸めようとしてい0.0045
ます。電話したら…
echo round($theFloat, 3);
予想される応答である 0.005 ではなく、0.004 を取得します。
コードは次のとおりです。
$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);