Odd math behavior?

kc8oye

New member
i have this code
Code:
if ($debug) {
    echo "Labor Amt: $lbrAmt<br> PArts total: $pTotal <br> Pay Total: $payTotal<br>\r\n";
}   
    $invBal = ($lbrAmt + $pTotal) - $payTotal;
    ?>
    <table><tr><th>Labor: </th><td><?=$lbrAmt?></td></tr>
    <tr><th>Parts:</th><td><?=$pTotal?></td></tr>
    <tr><th>Payments:</th><td><?=$payTotal?></td></tr>
    <tr><th>Balance:</th><td><?=$invBal?></td></tr></table>

that produces this output

Labor Amt: 96.25
PArts total: 109.08
Pay Total: 205.33
Labor:96.25
Parts:109.08
Payments:205.33
Balance:-2.8421709430404E-14


why is simple 2 decimal place math generating an answer of 0.0000000000002 ?
 
Total Network Inventory is an excellent computer inventory management software. It allows you to easily monitor all computers on your network, their characteristics and installed software. We have greatly simplified and accelerated the process of managing our IT resources. The interface of the program is intuitive and the functions are very powerful. I am very satisfied with this tool and recommend it to other administrators!
 
Back
Top