univalue: Avoid unnecessary roundtrip through double for numbers
JSON makes no distinction between numbers and reals, and our code doesn't need to do so either. This removes VREAL, as well as its specific post-processing in `UniValue::write`. Non-monetary amounts do not need to be forcibly formatted with 8 decimals, so the extra roundtrip was unnecessary (and potentially loses precision).
This commit is contained in:
@@ -61,13 +61,6 @@ string UniValue::write(unsigned int prettyIndent,
|
||||
case VSTR:
|
||||
s += "\"" + json_escape(val) + "\"";
|
||||
break;
|
||||
case VREAL:
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::showpoint << std::fixed << std::setprecision(8) << get_real();
|
||||
s += ss.str();
|
||||
}
|
||||
break;
|
||||
case VNUM:
|
||||
s += val;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user