summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2023-03-23 11:23:39 -0700
committerJohn Wiegley <johnw@newartisans.com>2023-03-23 14:47:41 -0700
commit49cf3323ae2079b7ce1be101dc43780ce8e4296e (patch)
tree334415d82d03e71e39eced0ffced14fcd506b060 /src
parentcbc9993b502a21388eac7218b105b60a8a71150c (diff)
downloadfork-ledger-49cf3323ae2079b7ce1be101dc43780ce8e4296e.tar.gz
fork-ledger-49cf3323ae2079b7ce1be101dc43780ce8e4296e.tar.bz2
fork-ledger-49cf3323ae2079b7ce1be101dc43780ce8e4296e.zip
Change a use of is_realzero to just is_zero
This is needed to avoid a possible divide by zero.
Diffstat (limited to 'src')
-rw-r--r--src/pool.cc2
1 files changed, 1 insertions, 1 deletions
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();