My code is very simple, for example, my php version is 5.5.11, this is my sample code:
$result = round(($num / 100), 2); // 0.070000000001
$result = $num / 100; // 0.070000000001
I get the $result
is 0.070000000001
, and if $num = 3
, the $result
is correct. And I used var_dump($num)
, the type is the float. how can I fix it?
edit
I found the reason, but I'm not sure the detail. I use Codeigniter, and I load a library PHPExcel
, this is third party lib, when I load it, and I will have this problem, but I'm not sure the reason detail.