math - somethings wrong

From: Date: Wed, 16 May 2001 23:38:25 +0000
Subject: math - somethings wrong
Groups: php.general 
Request: Send a blank email to php-general+get-53124@lists.php.net to get a copy of this message
$percentage=(($target_score/($fleet_score+$total_score))*.4)*100; if ($percentage >= 10) { $percentage='10'; $capped=$target_roids*($percentage/100); } else { $capped=$target_roids*($percentage/100); } } I get different results on a calculator than I don with this script. This is the order i do things on the calc: ($fleet_score+$total_score))*.4) then the (($target_score/ then the *100 i think my problem is some where in the if ($percent >=10) that port is there because regardless of the results returned by the formula the percentage can never be larger than 10

« previous php.general (#53124) next »