Skip to content

Commit 445c2f2

Browse files
author
minium
committed
Fixed double imprecisionness issues. Properly #2.
1 parent 8f6f084 commit 445c2f2

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/bitcoinapi/bitcoinapi.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,6 @@ BitcoinAPI::~BitcoinAPI()
4444
delete httpClient;
4545
}
4646

47-
string BitcoinAPI::IntegerToString(int num){
48-
std::ostringstream ss;
49-
ss << num;
50-
return ss.str();
51-
}
52-
53-
std::string BitcoinAPI::RoundDouble(double num)
54-
{
55-
std::ostringstream ss;
56-
ss.precision(16);
57-
58-
ss << num;
59-
return ss.str();
60-
}
61-
6247
Value BitcoinAPI::sendcommand(const string& command, const Value& params){
6348
Value result;
6449

@@ -77,6 +62,22 @@ Value BitcoinAPI::sendcommand(const string& command, const Value& params){
7762
}
7863

7964

65+
string BitcoinAPI::IntegerToString(int num){
66+
std::ostringstream ss;
67+
ss << num;
68+
return ss.str();
69+
}
70+
71+
std::string BitcoinAPI::RoundDouble(double num)
72+
{
73+
std::ostringstream ss;
74+
ss.precision(8);
75+
76+
ss << std::fixed << num;
77+
return ss.str();
78+
}
79+
80+
8081
/* === General functions === */
8182
getinfo_t BitcoinAPI::getinfo() {
8283
string command = "getinfo";

0 commit comments

Comments
 (0)