Avoid sprintf decimal-point localization
This commit is contained in:
parent
b0ad55a08a
commit
8a9cad44a5
1 changed files with 6 additions and 1 deletions
7
util.cpp
7
util.cpp
|
@ -313,7 +313,12 @@ void ParseString(const string& str, char c, vector<string>& v)
|
||||||
|
|
||||||
string FormatMoney(int64 n, bool fPlus)
|
string FormatMoney(int64 n, bool fPlus)
|
||||||
{
|
{
|
||||||
string str = strprintf("%.08f", double(n > 0 ? n : -n)/double(COIN));
|
// Note: not using straight sprintf here because we do NOT want
|
||||||
|
// localized number formatting.
|
||||||
|
int64 n_abs = (n > 0 ? n : -n);
|
||||||
|
int64 quotient = n_abs/COIN;
|
||||||
|
int64 remainder = n_abs%COIN;
|
||||||
|
string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder);
|
||||||
|
|
||||||
// Right-trim excess 0's before the decimal point:
|
// Right-trim excess 0's before the decimal point:
|
||||||
int nTrim = 0;
|
int nTrim = 0;
|
||||||
|
|
Loading…
Reference in a new issue