Jump to content

[SOLVED] incorrect answer when dividing why?


mdannatt

Recommended Posts

I am trying to divide two numbers $TAP ($10,330,000.00) by $TOTP($26,250,000.00). When echo'd I get 0.3846, but a simple check on my calculator show the real answer is 0.3935. Anyone have any ideas? the difference makes the calculation worthless. I am using XAMPP, latest release, if thats of any help.

.

 

$B = ($TAP / $TOTP);

$C = $targetcontr;

$D = $maxvaluecontr;

$BCcalc = $B/$C;

$BCDcalc = ($BCcalc * $D);

$BCDcalcMIN = MIN($BCDcalc,$D);

echo $TAP."<br/>";

echo $TOTP."<br/>";

echo "The adjusted procurement ratio is : ".number_format($B,4)."<br/>";

The first comma , that is encountered in each number is a stop character. So, the result is 10/26.

 

Comma separators in numbers are there for human readability and don't belong in numbers in computers until the point where you want to output them in a human readable format.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.