Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Side by Side Diff: runtime/vm/double_conversion.cc

Issue 8958018: ToStringAsFixed returns now 0 instead of -0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/double_conversion.h" 5 #include "vm/double_conversion.h"
6 6
7 #include "third_party/double-conversion/src/double-conversion.h" 7 #include "third_party/double-conversion/src/double-conversion.h"
8 8
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return false; 48 return false;
49 } 49 }
50 50
51 bool DoubleToStringAsFixed(double d, int fraction_digits, String& result) { 51 bool DoubleToStringAsFixed(double d, int fraction_digits, String& result) {
52 static const int kMinFractionDigits = 0; 52 static const int kMinFractionDigits = 0;
53 static const int kMaxFractionDigits = 20; 53 static const int kMaxFractionDigits = 20;
54 static const int kMaxDigitsBeforePoint = 20; 54 static const int kMaxDigitsBeforePoint = 20;
55 // The boundaries are exclusive. 55 // The boundaries are exclusive.
56 static const double kLowerBoundary = -1e21; 56 static const double kLowerBoundary = -1e21;
57 static const double kUpperBoundary = 1e21; 57 static const double kUpperBoundary = 1e21;
58 // TODO(floitsch): remove the UNIQUE_ZERO flag when the test is updated.
58 static const int kConversionFlags = 59 static const int kConversionFlags =
59 double_conversion::DoubleToStringConverter::NO_FLAGS; 60 double_conversion::DoubleToStringConverter::UNIQUE_ZERO;
60 const int kBufferSize = 128; 61 const int kBufferSize = 128;
61 // The output contains the sign, at most kMaxDigitsBeforePoint digits, 62 // The output contains the sign, at most kMaxDigitsBeforePoint digits,
62 // the decimal point followed by at most fraction_digits digits plus the \0. 63 // the decimal point followed by at most fraction_digits digits plus the \0.
63 ASSERT(kBufferSize >= 1 + kMaxDigitsBeforePoint + 1 + kMaxFractionDigits + 1); 64 ASSERT(kBufferSize >= 1 + kMaxDigitsBeforePoint + 1 + kMaxFractionDigits + 1);
64 65
65 if (d <= kLowerBoundary || d >= kUpperBoundary) { 66 if (d <= kLowerBoundary || d >= kUpperBoundary) {
66 return false; 67 return false;
67 } 68 }
68 if (fraction_digits < kMinFractionDigits || 69 if (fraction_digits < kMinFractionDigits ||
69 fraction_digits > kMaxFractionDigits) { 70 fraction_digits > kMaxFractionDigits) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 kDoubleToStringCommonExponentChar, 142 kDoubleToStringCommonExponentChar,
142 0, 0, // Ignored in precision mode. 143 0, 0, // Ignored in precision mode.
143 kMaxLeadingPaddingZeroes, 144 kMaxLeadingPaddingZeroes,
144 kMaxTrailingPaddingZeroes); 145 kMaxTrailingPaddingZeroes);
145 146
146 UNIMPLEMENTED(); 147 UNIMPLEMENTED();
147 return false; 148 return false;
148 } 149 }
149 150
150 } // namespace dart 151 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698