$total_cost and $amount_paid value is 2028.36 as shown in the bottom right screenshot
// values are from database. both are type decimal 15,2
$balance = ($total_cost - $amount_paid);
the result is 2.2737367544323E-13
结果应为0.我尝试将两者都转换为浮点数。仍然没有工作
查看下面的截图。我试着打印这个值,结果显示在右下角。
我在数据库级别进行了计算。
$this->db->select('(SUM(ItemCost * OrderQty) - OrderAmountPaid) - Discount as Balance');