3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = 0.03; $b = 1 - 0.97; $c = (float)(string) 0.03; $d = (float)(string) (1 - 0.97); var_dump($a, $b, $a === $b, $c, $d, $c === $d); var_dump(sprintf('%1.20f', $b), sprintf('%1.20f', $d));
Output for 5.2.1 - 7.1.0
float(0.03) float(0.03) bool(false) float(0.03) float(0.03) bool(true) string(22) "0.03000000000000002665" string(22) "0.02999999999999999889"
Output for 4.3.0 - 5.2.0
float(0.03) float(0.03) bool(false) float(0.03) float(0.03) bool(true) string(22) "0.03000000000000002665" string(22) "0.03000000000000000000"