From bba49a6d09ddc004daccadaa14361187f8c66e37 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 19 May 2023 20:14:58 -0500 Subject: [PATCH] Fix test-gnc-euro failure. Fixing the pow[] array required also adjusting the number of denominator digits when converting doubles to gnc_numerics. --- libgnucash/engine/gnc-numeric.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgnucash/engine/gnc-numeric.cpp b/libgnucash/engine/gnc-numeric.cpp index 7ab1ed20634..163776a4497 100644 --- a/libgnucash/engine/gnc-numeric.cpp +++ b/libgnucash/engine/gnc-numeric.cpp @@ -79,7 +79,7 @@ GncNumeric::GncNumeric(GncRational rr) GncNumeric::GncNumeric(double d) : m_num(0), m_den(1) { - static uint64_t max_leg_value{INT64_C(1000000000000000000)}; + static uint64_t max_leg_value{INT64_C(100000000000000000)}; if (std::isnan(d) || fabs(d) > max_leg_value) { std::ostringstream msg; @@ -91,7 +91,7 @@ GncNumeric::GncNumeric(double d) : m_num(0), m_den(1) int64_t den; uint8_t den_digits; if (logval > 0.0) - den_digits = (max_leg_digits + 1) - static_cast(floor(logval) + 1.0); + den_digits = (max_leg_digits + 1) - static_cast(floor(logval)); else den_digits = max_leg_digits; den = powten(den_digits);