dd_gamer Posted April 11, 2012 Share Posted April 11, 2012 I have an issue that needs to be corrected by can't figure the math part. The current code charges 50% but I need to change it to charge 60%... the issue is that the math is using "/2" to get the 50% so how do I change to 60%? The current code : // If shipping method is ground we only want to change half. if ($this->shipn[$num]=="Ground") $return[$num][rate]=$return[$num][rate]/2; return $return; } Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/ Share on other sites More sharing options...
Jessica Posted April 11, 2012 Share Posted April 11, 2012 instead of /2 do *.6 50 percent is half. /2 = half. This is the same as *.5 So 60 percent is *.6 Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336509 Share on other sites More sharing options...
PFMaBiSmAd Posted April 11, 2012 Share Posted April 11, 2012 50% is the same as multiplying by .5 (i.e. multiplying by 1/2), 60% is the same as multiplying by .6 I'm pretty sure your middle school and/or high school math teachers would be disappointed about now. Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336510 Share on other sites More sharing options...
synking Posted April 11, 2012 Share Posted April 11, 2012 if i am not mistaken you would need to change a lot of that formula as 60% can not be easily represented in a number. you would need to use a formula of %/100 = is/of so 60%/100 = is a % / of some number Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336511 Share on other sites More sharing options...
PFMaBiSmAd Posted April 11, 2012 Share Posted April 11, 2012 LOL. Don't make it harder than it really is. Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336512 Share on other sites More sharing options...
KevinM1 Posted April 11, 2012 Share Posted April 11, 2012 LOL. Don't make it harder than it really is. Especially considering that floating point is imprecise anyway. Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336513 Share on other sites More sharing options...
PFMaBiSmAd Posted April 11, 2012 Share Posted April 11, 2012 I just checked with a 5th grader and she correctly got that you multiply by 6/10 or .6 to find 60% of something. Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336516 Share on other sites More sharing options...
Jessica Posted April 11, 2012 Share Posted April 11, 2012 I just checked with a 5th grader and she correctly got that you multiply by 6/10 or .6 to find 60% of something. I'm kind of disappointed in our smiley selection, I couldn't quite find one that expressed my glee in this comment. Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336521 Share on other sites More sharing options...
dd_gamer Posted April 11, 2012 Author Share Posted April 11, 2012 OK... I guess I'm "NOT" smarter than a 5th grader... but thanks for the help... Quote Link to comment https://forums.phpfreaks.com/topic/260760-php-simple-math/#findComment-1336522 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.