From f905467a443f44897c60614e9f9149336f7eae3c Mon Sep 17 00:00:00 2001 From: Adrian Panella Date: Mon, 13 May 2019 23:05:11 -0500 Subject: [PATCH] [numeric] Fix constructor from strings in range (0 ,1) Fix error that caused strings in the form 0.nnn to be converted to negative numerics. --- libgnucash/engine/gnc-numeric.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgnucash/engine/gnc-numeric.cpp b/libgnucash/engine/gnc-numeric.cpp index a2e6c2a49c..a2cbf6d1c8 100644 --- a/libgnucash/engine/gnc-numeric.cpp +++ b/libgnucash/engine/gnc-numeric.cpp @@ -178,7 +178,7 @@ GncNumeric::GncNumeric(const std::string& str, bool autoround) GncInt128 high(stoll(m[1].str())); GncInt128 low(stoll(m[2].str())); int64_t d = powten(m[2].str().length()); - GncInt128 n = high * d + (high > 0 ? low : -low); + GncInt128 n = high * d + (high >= 0 ? low : -low); if (!autoround && n.isBig()) { std::ostringstream errmsg;