summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2023-02-23 17:44:02 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2023-02-24 13:37:07 +0100
commite0f9671338ce742a3ee168e867481be515dcce46 (patch)
tree05be8f565f7eaa7105374832ba5645e1a22ff3b8 /src/corelib/text/qlocale.cpp
parent846e5324589f9b9a61d44b5b9001c7ebf93dbecc (diff)
Reflow some code and comments in the aftermath of a dedent
There's more space to the right now, so we may as well use it. Change-Id: I653c52e1a2fb9eb2a0b027be90fb7bc2734a5e85 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text/qlocale.cpp')
-rw-r--r--src/corelib/text/qlocale.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index acece0c5d5..2bb9a1eaf5 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -3577,19 +3577,17 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form,
mustMarkDecimal, groupDigits);
break;
case DFSignificantDigits: {
- PrecisionMode mode = (flags & AddTrailingZeroes) ?
- PMSignificantDigits : PMChopTrailingZeros;
+ PrecisionMode mode
+ = (flags & AddTrailingZeroes) ? PMSignificantDigits : PMChopTrailingZeros;
- /* POSIX specifies sprintf() to follow fprintf(), whose 'g/G'
- format says; with P = 6 if precision unspecified else 1 if
- precision is 0 else precision; when 'e/E' would have exponent
- X, use:
+ /* POSIX specifies sprintf() to follow fprintf(), whose 'g/G' format
+ says; with P = 6 if precision unspecified else 1 if precision is
+ 0 else precision; when 'e/E' would have exponent X, use:
* 'f/F' if P > X >= -4, with precision P-1-X
* 'e/E' otherwise, with precision P-1
- Helpfully, we already have mapped precision < 0 to 6 - except
- for F.P.Shortest mode, which is its own story - and those of
- our callers with unspecified precision either used 6 or -1
- for it.
+ Helpfully, we already have mapped precision < 0 to 6 - except for
+ F.P.Shortest mode, which is its own story - and those of our
+ callers with unspecified precision either used 6 or -1 for it.
*/
bool useDecimal;
if (precision == QLocale::FloatingPointShortest) {
@@ -3618,13 +3616,12 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form,
--bias; // exponent but not decimal
}
// When 0 < decpt <= digitCount, the forms have equal digit
- // counts, plus things bias has taken into account;
- // otherwise decimal form's digit count is right-padded with
- // zeros to decpt, when decpt is positive, otherwise it's
- // left-padded with 1 - decpt zeros.
+ // counts, plus things bias has taken into account; otherwise
+ // decimal form's digit count is right-padded with zeros to
+ // decpt, when decpt is positive, otherwise it's left-padded
+ // with 1 - decpt zeros.
useDecimal = (decpt <= 0 ? 1 - decpt <= bias
- : decpt <= digitCount ? 0 <= bias
- : decpt <= digitCount + bias);
+ : decpt <= digitCount ? 0 <= bias : decpt <= digitCount + bias);
} else {
// X == decpt - 1, POSIX's P; -4 <= X < P iff -4 < decpt <= P
Q_ASSERT(precision >= 0);