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

Side by Side Diff: src/conversions.cc

Issue 1547017: Updating a comment in InternalStringToInt. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 months 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) { 351 if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
352 return JUNK_STRING_VALUE; 352 return JUNK_STRING_VALUE;
353 } 353 }
354 354
355 ASSERT(buffer_pos < kBufferSize); 355 ASSERT(buffer_pos < kBufferSize);
356 buffer[buffer_pos++] = '\0'; 356 buffer[buffer_pos++] = '\0';
357 return sign ? -gay_strtod(buffer, NULL) : gay_strtod(buffer, NULL); 357 return sign ? -gay_strtod(buffer, NULL) : gay_strtod(buffer, NULL);
358 } 358 }
359 359
360 // TODO(serya): The following legacy code causes accumulating rounding 360 // The following code causes accumulating rounding error for numbers greater
361 // error for number greater than ~2^56. It should be rewritten using long 361 // than ~2^56. It's explicitly allowed in the spec: "if R is not 2, 4, 8, 10,
362 // arithmetic. 362 // 16, or 32, then mathInt may be an implementation-dependent approximation to
363 // the mathematical integer value" (15.1.2.2).
363 364
364 int lim_0 = '0' + (radix < 10 ? radix : 10); 365 int lim_0 = '0' + (radix < 10 ? radix : 10);
365 int lim_a = 'a' + (radix - 10); 366 int lim_a = 'a' + (radix - 10);
366 int lim_A = 'A' + (radix - 10); 367 int lim_A = 'A' + (radix - 10);
367 368
368 // NOTE: The code for computing the value may seem a bit complex at 369 // NOTE: The code for computing the value may seem a bit complex at
369 // first glance. It is structured to use 32-bit multiply-and-add 370 // first glance. It is structured to use 32-bit multiply-and-add
370 // loops as long as possible to avoid loosing precision. 371 // loops as long as possible to avoid loosing precision.
371 372
372 double v = 0.0; 373 double v = 0.0;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 // Allocate result and fill in the parts. 1094 // Allocate result and fill in the parts.
1094 StringBuilder builder(result_size + 1); 1095 StringBuilder builder(result_size + 1);
1095 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); 1096 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size);
1096 if (decimal_pos > 0) builder.AddCharacter('.'); 1097 if (decimal_pos > 0) builder.AddCharacter('.');
1097 builder.AddSubstring(decimal_buffer, decimal_pos); 1098 builder.AddSubstring(decimal_buffer, decimal_pos);
1098 return builder.Finalize(); 1099 return builder.Finalize();
1099 } 1100 }
1100 1101
1101 1102
1102 } } // namespace v8::internal 1103 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698