summaryrefslogtreecommitdiffstats
path: root/mfbt/double-conversion/to-fixed-dbl-max.patch
diff options
context:
space:
mode:
Diffstat (limited to 'mfbt/double-conversion/to-fixed-dbl-max.patch')
-rw-r--r--mfbt/double-conversion/to-fixed-dbl-max.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/mfbt/double-conversion/to-fixed-dbl-max.patch b/mfbt/double-conversion/to-fixed-dbl-max.patch
new file mode 100644
index 0000000000..3b1cbf0b45
--- /dev/null
+++ b/mfbt/double-conversion/to-fixed-dbl-max.patch
@@ -0,0 +1,51 @@
+diff --git a/mfbt/double-conversion/double-conversion/double-to-string.cc b/mfbt/double-conversion/double-conversion/double-to-string.cc
+--- a/mfbt/double-conversion/double-conversion/double-to-string.cc
++++ b/mfbt/double-conversion/double-conversion/double-to-string.cc
+@@ -207,25 +207,21 @@ bool DoubleToStringConverter::ToShortest
+ }
+ return true;
+ }
+
+
+ bool DoubleToStringConverter::ToFixed(double value,
+ int requested_digits,
+ StringBuilder* result_builder) const {
+- DOUBLE_CONVERSION_ASSERT(kMaxFixedDigitsBeforePoint == 60);
+- const double kFirstNonFixed = 1e60;
+-
+ if (Double(value).IsSpecial()) {
+ return HandleSpecialValues(value, result_builder);
+ }
+
+ if (requested_digits > kMaxFixedDigitsAfterPoint) return false;
+- if (value >= kFirstNonFixed || value <= -kFirstNonFixed) return false;
+
+ // Find a sufficiently precise decimal representation of n.
+ int decimal_point;
+ bool sign;
+ // Add space for the '\0' byte.
+ const int kDecimalRepCapacity =
+ kMaxFixedDigitsBeforePoint + kMaxFixedDigitsAfterPoint + 1;
+ char decimal_rep[kDecimalRepCapacity];
+diff --git a/mfbt/double-conversion/double-conversion/double-to-string.h b/mfbt/double-conversion/double-conversion/double-to-string.h
+--- a/mfbt/double-conversion/double-conversion/double-to-string.h
++++ b/mfbt/double-conversion/double-conversion/double-to-string.h
+@@ -33,17 +33,17 @@
+
+ namespace double_conversion {
+
+ class DoubleToStringConverter {
+ public:
+ // When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint
+ // or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the
+ // function returns false.
+- static const int kMaxFixedDigitsBeforePoint = 60;
++ static const int kMaxFixedDigitsBeforePoint = 308;
+ static const int kMaxFixedDigitsAfterPoint = 100;
+
+ // When calling ToExponential with a requested_digits
+ // parameter > kMaxExponentialDigits then the function returns false.
+ static const int kMaxExponentialDigits = 120;
+
+ // When calling ToPrecision with a requested_digits
+ // parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits