Revision: 5760 Author: [email protected] Date: Wed Nov 3 05:05:01 2010 Log: Fix assumptions in DoubleToFixed.
By luck two errors cancelled each other out. Review URL: http://codereview.chromium.org/4135014 http://code.google.com/p/v8/source/detail?r=5760 Modified: /branches/bleeding_edge/src/conversions.cc ======================================= --- /branches/bleeding_edge/src/conversions.cc Thu Oct 14 06:47:48 2010 +++ /branches/bleeding_edge/src/conversions.cc Wed Nov 3 05:05:01 2010 @@ -816,7 +816,7 @@ char* DoubleToFixedCString(double value, int f) { - const int kMaxDigitsBeforePoint = 20; + const int kMaxDigitsBeforePoint = 21; const double kFirstNonFixed = 1e21; const int kMaxDigitsAfterPoint = 20; ASSERT(f >= 0); @@ -840,9 +840,9 @@ // Find a sufficiently precise decimal representation of n. int decimal_point; int sign; - // Add space for the '.' and the '\0' byte. + // Add space for the '\0' byte. const int kDecimalRepCapacity = - kMaxDigitsBeforePoint + kMaxDigitsAfterPoint + 2; + kMaxDigitsBeforePoint + kMaxDigitsAfterPoint + 1; char decimal_rep[kDecimalRepCapacity]; int decimal_rep_length; bool status = DoubleToAscii(value, DTOA_FIXED, f, -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
