php calculate float

后端 未结 3 881
挽巷
挽巷 2021-01-14 12:23

I have a weird math calculation here. I hope someone will explain.

$a = 1.85/100;
$b = 1.5/100;
$c = 1.1/100;
$d = 0.4/100;
$e = 0.4/100;
$f = 0.4/100;
$g =         


        
3条回答
  •  时光说笑
    2021-01-14 13:11

    any idea to correct my equation to show final result 0.00 ?

    Yeah, round($i, 2)

    The "discrepancies" are usually so small, that rounding it to 2 decimals will almost always solve the problem.

提交回复
热议问题