Skip to content

Rounds very large negative numbers to the incorrect values #3580

@SternAndrew

Description

@SternAndrew

Poco::Int64 val1;
Poco::Int64 val2;

Poco::NumberParser::tryParse64("-8070450532247927553", val1);
Poco::NumberParser::tryParse64("8070450532247927553", val2);

The results are:
(gdb) p val1
$32 = -8070450532247927808
(gdb) p val2
$33 = 8070450532247927553

But val1 should be : -8070450532247927553.

This is caused by the line : i = static_cast<intmax_t>(FPEnvironment::copySign(static_cast(result), -1));
In NumericString.h near bottom of method strToInt

Perhaps the if statement on the line above should be as follows?
if (result > limitCheck)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions