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

Side by Side Diff: base/third_party/dmg_fp/dtoa.cc

Issue 2296503003: Fix parsing of exponents in StringToDouble. (Closed)
Patch Set: better comments Created 4 years, 3 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
« no previous file with comments | « base/third_party/dmg_fp/README.chromium ('k') | base/third_party/dmg_fp/exp_length.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /**************************************************************** 1 /****************************************************************
2 * 2 *
3 * The author of this software is David M. Gay. 3 * The author of this software is David M. Gay.
4 * 4 *
5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. 5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose without fee is hereby granted, provided that this entire notice 8 * purpose without fee is hereby granted, provided that this entire notice
9 * is included in all copies of any software which is or includes a copy 9 * is included in all copies of any software which is or includes a copy
10 * or modification of this software and in all copies of the supporting 10 * or modification of this software and in all copies of the supporting
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 esign = 1; 2590 esign = 1;
2591 case '+': 2591 case '+':
2592 c = *++s; 2592 c = *++s;
2593 } 2593 }
2594 if (c >= '0' && c <= '9') { 2594 if (c >= '0' && c <= '9') {
2595 while(c == '0') 2595 while(c == '0')
2596 c = *++s; 2596 c = *++s;
2597 if (c > '0' && c <= '9') { 2597 if (c > '0' && c <= '9') {
2598 L = c - '0'; 2598 L = c - '0';
2599 s1 = s; 2599 s1 = s;
2600 » » » » while((c = *++s) >= '0' && c <= '9') 2600 » » » » while((c = *++s) >= '0' && c <= '9') {
2601 L = 10*L + c - '0'; 2601 L = 10*L + c - '0';
2602 if (L > DBL_MAX_10_EXP)
2603 break;
2604 }
2602 if (s - s1 > 8 || L > 19999) 2605 if (s - s1 > 8 || L > 19999)
2603 /* Avoid confusion from exponents 2606 /* Avoid confusion from exponents
2604 * so large that e might overflow. 2607 * so large that e might overflow.
2605 */ 2608 */
2606 e = 19999; /* safe for 16 bit ints */ 2609 e = 19999; /* safe for 16 bit ints */
2607 else 2610 else
2608 e = (int)L; 2611 e = (int)L;
2609 if (esign) 2612 if (esign)
2610 e = -e; 2613 e = -e;
2611 } 2614 }
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 #endif 4228 #endif
4226 Bfree(b); 4229 Bfree(b);
4227 *s = 0; 4230 *s = 0;
4228 *decpt = k + 1; 4231 *decpt = k + 1;
4229 if (rve) 4232 if (rve)
4230 *rve = s; 4233 *rve = s;
4231 return s0; 4234 return s0;
4232 } 4235 }
4233 4236
4234 } // namespace dmg_fp 4237 } // namespace dmg_fp
OLDNEW
« no previous file with comments | « base/third_party/dmg_fp/README.chromium ('k') | base/third_party/dmg_fp/exp_length.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698