41 using namespace v8::internal;
46 static void TrimRepresentation(
Vector<char> representation) {
49 for (i = len - 1; i >= 0; --i) {
50 if (representation[i] !=
'0')
break;
52 representation[i + 1] =
'\0';
56 static const int kBufferSize = 100;
59 TEST(BignumDtoaVariousDoubles) {
60 char buffer_container[kBufferSize];
71 TrimRepresentation(buffer);
77 TrimRepresentation(buffer);
87 TrimRepresentation(buffer);
93 TrimRepresentation(buffer);
97 double min_double = 5e-324;
104 TrimRepresentation(buffer);
109 TrimRepresentation(buffer);
113 double max_double = 1.7976931348623157e308;
120 TrimRepresentation(buffer);
135 TrimRepresentation(buffer);
140 buffer, &length, &point);
145 buffer, &length, &point);
147 TrimRepresentation(buffer);
152 buffer, &length, &point);
157 buffer, &length, &point);
159 TrimRepresentation(buffer);
164 buffer, &length, &point);
170 buffer, &length, &point);
172 TrimRepresentation(buffer);
177 buffer, &length, &point);
179 TrimRepresentation(buffer);
184 buffer, &length, &point);
189 buffer, &length, &point);
191 TrimRepresentation(buffer);
203 TrimRepresentation(buffer);
215 TrimRepresentation(buffer);
220 buffer, &length, &point);
224 v = 3.9292015898194142585311918e-10;
231 TrimRepresentation(buffer);
234 v = 3.3161339052167390562200598e-237;
237 TrimRepresentation(buffer);
241 v = 7.9885183916008099497815232e+191;
244 TrimRepresentation(buffer);
248 v = 1.0000000000000012800000000e+17;
251 TrimRepresentation(buffer);
258 char buffer_container[kBufferSize];
265 for (
int i = 0; i < precomputed.
length(); ++i) {
267 double v = current_test.
v;
276 char buffer_container[kBufferSize];
283 for (
int i = 0; i < precomputed.
length(); ++i) {
285 double v = current_test.
v;
289 CHECK_GE(number_digits, length - point);
290 TrimRepresentation(buffer);
297 char buffer_container[kBufferSize];
304 for (
int i = 0; i < precomputed.
length(); ++i) {
306 double v = current_test.
v;
309 buffer, &length, &point);
312 TrimRepresentation(buffer);
#define CHECK_EQ(expected, value)
Vector< const PrecomputedShortest > PrecomputedShortestRepresentations()
Vector< const PrecomputedPrecision > PrecomputedPrecisionRepresentations()
const char * representation
Vector< const PrecomputedFixed > PrecomputedFixedRepresentations()
void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits, Vector< char > buffer, int *length, int *decimal_point)
const char * representation
const char * representation
#define V8_2PART_UINT64_C(a, b)
int StrLength(const char *string)