mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibJS: Consistently use spaces / parentheses in NumberFormat operations
These are editorial changes in the ECMA-402 spec. See:1508825
760f23a
This commit is contained in:
parent
0ffad2a2d1
commit
0ff4d8100f
1 changed files with 5 additions and 5 deletions
|
@ -1083,7 +1083,7 @@ RawFormatResult to_raw_precision(MathematicalValue const& number, int min_precis
|
||||||
result.formatted_string = n.to_deprecated_string();
|
result.formatted_string = n.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. If e ≥ p–1, then
|
// 4. If e ≥ (p – 1), then
|
||||||
if (exponent >= (precision - 1)) {
|
if (exponent >= (precision - 1)) {
|
||||||
// a. Set m to the string-concatenation of m and e - p + 1 occurrences of the code unit 0x0030 (DIGIT ZERO).
|
// a. Set m to the string-concatenation of m and e - p + 1 occurrences of the code unit 0x0030 (DIGIT ZERO).
|
||||||
result.formatted_string = DeprecatedString::formatted(
|
result.formatted_string = DeprecatedString::formatted(
|
||||||
|
@ -1091,7 +1091,7 @@ RawFormatResult to_raw_precision(MathematicalValue const& number, int min_precis
|
||||||
result.formatted_string,
|
result.formatted_string,
|
||||||
DeprecatedString::repeated('0', exponent - precision + 1));
|
DeprecatedString::repeated('0', exponent - precision + 1));
|
||||||
|
|
||||||
// b. Let int be e+1.
|
// b. Let int be e + 1.
|
||||||
result.digits = exponent + 1;
|
result.digits = exponent + 1;
|
||||||
}
|
}
|
||||||
// 5. Else if e ≥ 0, then
|
// 5. Else if e ≥ 0, then
|
||||||
|
@ -1102,7 +1102,7 @@ RawFormatResult to_raw_precision(MathematicalValue const& number, int min_precis
|
||||||
result.formatted_string.substring_view(0, exponent + 1),
|
result.formatted_string.substring_view(0, exponent + 1),
|
||||||
result.formatted_string.substring_view(exponent + 1));
|
result.formatted_string.substring_view(exponent + 1));
|
||||||
|
|
||||||
// b. Let int be e+1.
|
// b. Let int be e + 1.
|
||||||
result.digits = exponent + 1;
|
result.digits = exponent + 1;
|
||||||
}
|
}
|
||||||
// 6. Else,
|
// 6. Else,
|
||||||
|
@ -1234,7 +1234,7 @@ RawFormatResult to_raw_fixed(MathematicalValue const& number, int min_fraction,
|
||||||
// ii. Let m be the string-concatenation of z and m.
|
// ii. Let m be the string-concatenation of z and m.
|
||||||
result.formatted_string = DeprecatedString::formatted("{}{}", zeroes, result.formatted_string);
|
result.formatted_string = DeprecatedString::formatted("{}{}", zeroes, result.formatted_string);
|
||||||
|
|
||||||
// iii. Let k be f+1.
|
// iii. Let k be f + 1.
|
||||||
decimals = fraction + 1;
|
decimals = fraction + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1514,7 +1514,7 @@ int compute_exponent(NumberFormat& number_format, MathematicalValue number)
|
||||||
// 8. Let newMagnitude be the base 10 logarithm of formatNumberResult.[[RoundedNumber]] rounded down to the nearest integer.
|
// 8. Let newMagnitude be the base 10 logarithm of formatNumberResult.[[RoundedNumber]] rounded down to the nearest integer.
|
||||||
int new_magnitude = format_number_result.rounded_number.logarithmic_floor();
|
int new_magnitude = format_number_result.rounded_number.logarithmic_floor();
|
||||||
|
|
||||||
// 9. If newMagnitude is magnitude – exponent, then
|
// 9. If newMagnitude is magnitude - exponent, then
|
||||||
if (new_magnitude == magnitude - exponent) {
|
if (new_magnitude == magnitude - exponent) {
|
||||||
// a. Return exponent.
|
// a. Return exponent.
|
||||||
return exponent;
|
return exponent;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue