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>
This commit is contained in:
Edward Welbourne 2023-02-23 17:44:02 +01:00
parent 846e532458
commit e0f9671338

View File

@ -3577,19 +3577,17 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form,
mustMarkDecimal, groupDigits); mustMarkDecimal, groupDigits);
break; break;
case DFSignificantDigits: { case DFSignificantDigits: {
PrecisionMode mode = (flags & AddTrailingZeroes) ? PrecisionMode mode
PMSignificantDigits : PMChopTrailingZeros; = (flags & AddTrailingZeroes) ? PMSignificantDigits : PMChopTrailingZeros;
/* POSIX specifies sprintf() to follow fprintf(), whose 'g/G' /* POSIX specifies sprintf() to follow fprintf(), whose 'g/G' format
format says; with P = 6 if precision unspecified else 1 if says; with P = 6 if precision unspecified else 1 if precision is
precision is 0 else precision; when 'e/E' would have exponent 0 else precision; when 'e/E' would have exponent X, use:
X, use:
* 'f/F' if P > X >= -4, with precision P-1-X * 'f/F' if P > X >= -4, with precision P-1-X
* 'e/E' otherwise, with precision P-1 * 'e/E' otherwise, with precision P-1
Helpfully, we already have mapped precision < 0 to 6 - except Helpfully, we already have mapped precision < 0 to 6 - except for
for F.P.Shortest mode, which is its own story - and those of F.P.Shortest mode, which is its own story - and those of our
our callers with unspecified precision either used 6 or -1 callers with unspecified precision either used 6 or -1 for it.
for it.
*/ */
bool useDecimal; bool useDecimal;
if (precision == QLocale::FloatingPointShortest) { if (precision == QLocale::FloatingPointShortest) {
@ -3618,13 +3616,12 @@ QString QLocaleData::doubleToString(double d, int precision, DoubleForm form,
--bias; // exponent but not decimal --bias; // exponent but not decimal
} }
// When 0 < decpt <= digitCount, the forms have equal digit // When 0 < decpt <= digitCount, the forms have equal digit
// counts, plus things bias has taken into account; // counts, plus things bias has taken into account; otherwise
// otherwise decimal form's digit count is right-padded with // decimal form's digit count is right-padded with zeros to
// zeros to decpt, when decpt is positive, otherwise it's // decpt, when decpt is positive, otherwise it's left-padded
// left-padded with 1 - decpt zeros. // with 1 - decpt zeros.
useDecimal = (decpt <= 0 ? 1 - decpt <= bias useDecimal = (decpt <= 0 ? 1 - decpt <= bias
: decpt <= digitCount ? 0 <= bias : decpt <= digitCount ? 0 <= bias : decpt <= digitCount + bias);
: decpt <= digitCount + bias);
} else { } else {
// X == decpt - 1, POSIX's P; -4 <= X < P iff -4 < decpt <= P // X == decpt - 1, POSIX's P; -4 <= X < P iff -4 < decpt <= P
Q_ASSERT(precision >= 0); Q_ASSERT(precision >= 0);