summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 6baa903c..4eacdd09 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -733,13 +733,9 @@ void amount_t::in_place_unreduce()
if (shifted) {
if (("h" == comm->symbol() || "m" == comm->symbol()) && commodity_t::time_colon_by_default) {
- amount_t floored = tmp.floored();
- amount_t precision = tmp - floored;
- if (precision < 0.0) {
- precision += 1.0;
- floored -= 1.0;
- }
- tmp = floored + (precision * (comm->smaller()->number() / 100.0));
+ double truncated = trunc(tmp.to_double());
+ double precision = tmp.to_double() - truncated;
+ tmp = truncated + (precision * (comm->smaller()->number() / 100.0));
}
*this = tmp;