Jump to content

Problem rounding decimals


phpretard

Recommended Posts

// do some math
$PZTotal = "17.97";
$FCTotal = "56.97";
$CHTotal = "65.7";
$GrandTotal = $PZTotal + $FCTotal + $CHTotal;
$Deposit = round($GrandTotal , 2) * .5; // This is wrong remove * .5 <-- that multiplys the result with 0.5
                                                       // which meand that it is divided by 2....
                                                       //SO Correct: $Deposit = round($GrandTotal , 2);

// do some math
$PZTotal = "17.97";
$FCTotal = "56.97";
$CHTotal = "65.7";
$GrandTotal = $PZTotal + $FCTotal + $CHTotal;
$Deposit = round($GrandTotal , 2) * .5; // This is wrong remove * .5 <-- that multiplys the result with 0.5
                                                       // which meand that it is divided by 2....
                                                       //SO Correct: $Deposit = round($GrandTotal , 2);

 

The deposit is half of the $GrandTotal.  Where should I do that math?

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.