gnucash stable: Fix test-gnc-euro failure.
John Ralls
jralls at code.gnucash.org
Fri May 19 21:16:57 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/bba49a6d (commit)
from https://github.com/Gnucash/gnucash/commit/b3bf11c8 (commit)
commit bba49a6d09ddc004daccadaa14361187f8c66e37
Author: John Ralls <jralls at ceridwen.us>
Date: Fri May 19 20:14:58 2023 -0500
Fix test-gnc-euro failure.
Fixing the pow[] array required also adjusting the number of
denominator digits when converting doubles to gnc_numerics.
diff --git a/libgnucash/engine/gnc-numeric.cpp b/libgnucash/engine/gnc-numeric.cpp
index 7ab1ed2063..163776a449 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<int>(floor(logval) + 1.0);
+ den_digits = (max_leg_digits + 1) - static_cast<int>(floor(logval));
else
den_digits = max_leg_digits;
den = powten(den_digits);
Summary of changes:
libgnucash/engine/gnc-numeric.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list