Fix a bug : don't double '-' sign on negative numbers
This commit is contained in:
parent
5ea898b837
commit
224267f360
|
@ -43,13 +43,9 @@ namespace uPDFParser
|
||||||
std::string Integer::str()
|
std::string Integer::str()
|
||||||
{
|
{
|
||||||
std::string sign("");
|
std::string sign("");
|
||||||
if (_signed)
|
// Sign automatically added for negative numbers
|
||||||
{
|
if (_signed && _value >= 0)
|
||||||
if (_value >= 0)
|
|
||||||
sign = "+";
|
sign = "+";
|
||||||
else
|
|
||||||
sign = "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
return " " + sign + std::to_string(_value);
|
return " " + sign + std::to_string(_value);
|
||||||
}
|
}
|
||||||
|
@ -57,13 +53,8 @@ namespace uPDFParser
|
||||||
std::string Real::str()
|
std::string Real::str()
|
||||||
{
|
{
|
||||||
std::string sign("");
|
std::string sign("");
|
||||||
if (_signed)
|
if (_signed && _value >= 0)
|
||||||
{
|
|
||||||
if (_value >= 0)
|
|
||||||
sign = "+";
|
sign = "+";
|
||||||
else
|
|
||||||
sign = "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
return " " + sign + std::to_string(_value);
|
return " " + sign + std::to_string(_value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user