From 9f256e8785066c14206b7a988803f929228a71ff Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 22 Oct 2010 16:30:09 +0000 Subject: (svn r21009) -Fix: for the compact notation 1.000.000k and 1.000M would be shown depending on the initial (and later rounded) value. Make everything that would round to 1.000.000k be drawn as 1.000M as well. --- src/strings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/strings.cpp b/src/strings.cpp index 0d27bb9c0..912acfe65 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -339,7 +339,9 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, Money n /* for huge numbers, compact the number into k or M */ if (compact) { - if (number >= 1000000000) { + /* Take care of the 'k' rounding. Having 1 000 000 k + * and 1 000 M is inconsistent, so always use 1 000 M. */ + if (number >= 1000000000 - 500) { number = (number + 500000) / 1000000; multiplier = "M"; } else if (number >= 1000000) { -- cgit v1.2.3-54-g00ecf