[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.
This commit is contained in:
Adrian Panella 2019-05-13 23:05:11 -05:00
parent 6e246ef8ad
commit f905467a44

View File

@ -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;