phpnewbie112 Posted October 25, 2008 Share Posted October 25, 2008 Hello, I have the following piece of code: $out = "1.1"; $rate = "1.1"; $after = $out/$rate; print $after; //Result is showing 1 normally the problem is with the following wrong result $a = "1"; $cnt = "1"; $b = (($out/$rate) - ($cnt * $a)); print $b; the result is supposed to be 0 but I am having as a result: 1.11022302463E-15 very wierd!!! Quote Link to comment https://forums.phpfreaks.com/topic/130086-solved-divide-numbers-strange-results/ Share on other sites More sharing options...
DarkWater Posted October 25, 2008 Share Posted October 25, 2008 $b = (round($out/$rate) - ($count * $a)); Try that. Quote Link to comment https://forums.phpfreaks.com/topic/130086-solved-divide-numbers-strange-results/#findComment-674480 Share on other sites More sharing options...
phpnewbie112 Posted October 25, 2008 Author Share Posted October 25, 2008 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/130086-solved-divide-numbers-strange-results/#findComment-674491 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.