gnucash stable: [gnc-euro.cpp] use GncNumeric.convert() instead of gnc_numeric_convert
Christopher Lam
clam at code.gnucash.org
Thu Jul 16 05:07:18 EDT 2026
Updated via https://github.com/Gnucash/gnucash/commit/36bd906b (commit)
from https://github.com/Gnucash/gnucash/commit/08ba690e (commit)
commit 36bd906b678c7384c9b1ddc19dc929eef271dc06
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Thu Jul 16 17:02:31 2026 +0800
[gnc-euro.cpp] use GncNumeric.convert() instead of gnc_numeric_convert
diff --git a/libgnucash/engine/gnc-euro.cpp b/libgnucash/engine/gnc-euro.cpp
index a46fe41c97..f51ce8ad3f 100644
--- a/libgnucash/engine/gnc-euro.cpp
+++ b/libgnucash/engine/gnc-euro.cpp
@@ -26,6 +26,7 @@
#include "gnc-euro.h"
#include "gnc-session.h"
#include <gnc-numeric.hpp>
+#include <gnc-rational-rounding.hpp>
/* The rates are per EURO and are denoted in GncNumeric */
static const boost::container::flat_map <std::string, GncNumeric> gnc_euro_rates =
@@ -87,7 +88,7 @@ gnc_convert_to_euro(const gnc_commodity * currency, gnc_numeric value)
/* EC Regulation 1103/97 states we should use "Round half away from zero"
* See https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A31997R1103&qid=1662917247821
*/
- return gnc_numeric_convert (value / *euro_rate, 100, GNC_HOW_RND_ROUND_HALF_UP);
+ return (value / *euro_rate).convert<RoundType::half_up>(100);
}
/* ------------------------------------------------------ */
@@ -101,8 +102,7 @@ gnc_convert_from_euro(const gnc_commodity * currency, gnc_numeric value)
/* EC Regulation 1103/97 states we should use "Round half away from zero"
* See http://europa.eu/legislation_summaries/economic_and_monetary_affairs/institutional_and_economic_framework/l25025_en.htm */
- return gnc_numeric_convert (value * *euro_rate, gnc_commodity_get_fraction (currency),
- GNC_HOW_RND_ROUND_HALF_UP);
+ return (value * *euro_rate).convert<RoundType::half_up>(gnc_commodity_get_fraction (currency));
}
/* ------------------------------------------------------ */
Summary of changes:
libgnucash/engine/gnc-euro.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
More information about the gnucash-changes
mailing list