aboutsummaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-02-28 21:34:36 +0000
committerGavin Andresen <gavinandresen@gmail.com>2011-02-28 21:34:36 +0000
commit8a9cad44a57f1e0057c127ced5078d7e722b9cc8 (patch)
tree37fb69aa9bbbd1cf082abc875090586aa0145da4 /util.cpp
parentb0ad55a08a32832709f3b298b588577422071a93 (diff)
Avoid sprintf decimal-point localization
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/util.cpp b/util.cpp
index 8518e27975..8a2f9d525e 100644
--- a/util.cpp
+++ b/util.cpp
@@ -313,7 +313,12 @@ void ParseString(const string& str, char c, vector<string>& v)
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:
int nTrim = 0;