diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-07-18 07:44:19 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-07-18 09:04:18 +0200 |
commit | 7650449a6777710cf818d41862626164da0cd412 (patch) | |
tree | ddb32fd03bd9df82961ea176810b50faba133a23 /src/univalue/univalue_write.cpp | |
parent | e061e2778d592826970483e0844308c4e9a12626 (diff) |
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).
Diffstat (limited to 'src/univalue/univalue_write.cpp')
-rw-r--r-- | src/univalue/univalue_write.cpp | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/univalue/univalue_write.cpp b/src/univalue/univalue_write.cpp index d360c253b0..bce3997af7 100644 --- a/src/univalue/univalue_write.cpp +++ b/src/univalue/univalue_write.cpp @@ -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; |