From 49cf3323ae2079b7ce1be101dc43780ce8e4296e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 23 Mar 2023 11:23:39 -0700 Subject: Change a use of is_realzero to just is_zero This is needed to avoid a possible divide by zero. --- src/pool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pool.cc') diff --git a/src/pool.cc b/src/pool.cc index 2c055d64..73e76644 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -257,7 +257,7 @@ commodity_pool_t::exchange(const amount_t& amount, current_annotation = &as_annotated_commodity(commodity).details; amount_t per_unit_cost = - (is_per_unit || amount.is_realzero()) ? cost.abs() : (cost / amount).abs(); + (is_per_unit || amount.is_zero()) ? cost.abs() : (cost / amount).abs(); if (! cost.has_commodity()) per_unit_cost.clear_commodity(); -- cgit v1.2.3