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

Side by Side Diff: test/cctest/test-conversions.cc

Issue 5195003: Remove Gay's dtoa from sources. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added files to ARM and x64 VS project files. Created 10 years, 1 month 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 | « src/third_party/dtoa/dtoa.c ('k') | tools/gyp/v8.gyp » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "platform.h" 7 #include "platform.h"
8 #include "cctest.h" 8 #include "cctest.h"
9 9
10 using namespace v8::internal; 10 using namespace v8::internal;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // double. Check chat z = (x + y) / 2 is rounded to x... 134 // double. Check chat z = (x + y) / 2 is rounded to x...
135 CHECK_EQ(24414062505131248.0, 135 CHECK_EQ(24414062505131248.0,
136 StringToDouble("24414062505131250.0", NO_FLAGS)); 136 StringToDouble("24414062505131250.0", NO_FLAGS));
137 137
138 // ... and z = (x + y) / 2 + delta is rounded to y. 138 // ... and z = (x + y) / 2 + delta is rounded to y.
139 CHECK_EQ(24414062505131252.0, 139 CHECK_EQ(24414062505131252.0,
140 StringToDouble("24414062505131250.000000001", NO_FLAGS)); 140 StringToDouble("24414062505131250.000000001", NO_FLAGS));
141 } 141 }
142 142
143 143
144 extern "C" double gay_strtod(const char* s00, const char** se);
145
146
147 TEST(MaximumSignificantDigits) { 144 TEST(MaximumSignificantDigits) {
148 char num[] = 145 char num[] =
149 "4.4501477170144020250819966727949918635852426585926051135169509" 146 "4.4501477170144020250819966727949918635852426585926051135169509"
150 "122872622312493126406953054127118942431783801370080830523154578" 147 "122872622312493126406953054127118942431783801370080830523154578"
151 "251545303238277269592368457430440993619708911874715081505094180" 148 "251545303238277269592368457430440993619708911874715081505094180"
152 "604803751173783204118519353387964161152051487413083163272520124" 149 "604803751173783204118519353387964161152051487413083163272520124"
153 "606023105869053620631175265621765214646643181420505164043632222" 150 "606023105869053620631175265621765214646643181420505164043632222"
154 "668006474326056011713528291579642227455489682133472873831754840" 151 "668006474326056011713528291579642227455489682133472873831754840"
155 "341397809846934151055619529382191981473003234105366170879223151" 152 "341397809846934151055619529382191981473003234105366170879223151"
156 "087335413188049110555339027884856781219017754500629806224571029" 153 "087335413188049110555339027884856781219017754500629806224571029"
157 "581637117459456877330110324211689177656713705497387108207822477" 154 "581637117459456877330110324211689177656713705497387108207822477"
158 "584250967061891687062782163335299376138075114200886249979505279" 155 "584250967061891687062782163335299376138075114200886249979505279"
159 "101870966346394401564490729731565935244123171539810221213221201" 156 "101870966346394401564490729731565935244123171539810221213221201"
160 "847003580761626016356864581135848683152156368691976240370422601" 157 "847003580761626016356864581135848683152156368691976240370422601"
161 "6998291015625000000000000000000000000000000000e-308"; 158 "6998291015625000000000000000000000000000000000e-308";
162 159
163 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 160 CHECK_EQ(4.4501477170144017780491e-308, StringToDouble(num, NO_FLAGS));
164 161
165 // Changes the result of strtod (at least in glibc implementation). 162 // Changes the result of strtod (at least in glibc implementation).
166 num[sizeof(num) - 8] = '1'; 163 num[sizeof(num) - 8] = '1';
167 164
168 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 165 CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(num, NO_FLAGS));
169 } 166 }
170 167
171 TEST(MinimumExponent) { 168 TEST(MinimumExponent) {
172 // Same test but with different point-position. 169 // Same test but with different point-position.
173 char num[] = 170 char num[] =
174 "445014771701440202508199667279499186358524265859260511351695091" 171 "445014771701440202508199667279499186358524265859260511351695091"
175 "228726223124931264069530541271189424317838013700808305231545782" 172 "228726223124931264069530541271189424317838013700808305231545782"
176 "515453032382772695923684574304409936197089118747150815050941806" 173 "515453032382772695923684574304409936197089118747150815050941806"
177 "048037511737832041185193533879641611520514874130831632725201246" 174 "048037511737832041185193533879641611520514874130831632725201246"
178 "060231058690536206311752656217652146466431814205051640436322226" 175 "060231058690536206311752656217652146466431814205051640436322226"
179 "680064743260560117135282915796422274554896821334728738317548403" 176 "680064743260560117135282915796422274554896821334728738317548403"
180 "413978098469341510556195293821919814730032341053661708792231510" 177 "413978098469341510556195293821919814730032341053661708792231510"
181 "873354131880491105553390278848567812190177545006298062245710295" 178 "873354131880491105553390278848567812190177545006298062245710295"
182 "816371174594568773301103242116891776567137054973871082078224775" 179 "816371174594568773301103242116891776567137054973871082078224775"
183 "842509670618916870627821633352993761380751142008862499795052791" 180 "842509670618916870627821633352993761380751142008862499795052791"
184 "018709663463944015644907297315659352441231715398102212132212018" 181 "018709663463944015644907297315659352441231715398102212132212018"
185 "470035807616260163568645811358486831521563686919762403704226016" 182 "470035807616260163568645811358486831521563686919762403704226016"
186 "998291015625000000000000000000000000000000000e-1108"; 183 "998291015625000000000000000000000000000000000e-1108";
187 184
188 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 185 CHECK_EQ(4.4501477170144017780491e-308, StringToDouble(num, NO_FLAGS));
189 186
190 // Changes the result of strtod (at least in glibc implementation). 187 // Changes the result of strtod (at least in glibc implementation).
191 num[sizeof(num) - 8] = '1'; 188 num[sizeof(num) - 8] = '1';
192 189
193 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 190 CHECK_EQ(4.4501477170144022721148e-308, StringToDouble(num, NO_FLAGS));
194 } 191 }
195 192
196 193
197 TEST(MaximumExponent) { 194 TEST(MaximumExponent) {
198 char num[] = "0.16e309"; 195 char num[] = "0.16e309";
199 196
200 CHECK_EQ(gay_strtod(num, NULL), StringToDouble(num, NO_FLAGS)); 197 CHECK_EQ(1.59999999999999997765e+308, StringToDouble(num, NO_FLAGS));
201 } 198 }
202 199
203 200
204 TEST(ExponentNumberStr) { 201 TEST(ExponentNumberStr) {
205 CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS)); 202 CHECK_EQ(1e1, StringToDouble("1e1", NO_FLAGS));
206 CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS)); 203 CHECK_EQ(1e1, StringToDouble("1e+1", NO_FLAGS));
207 CHECK_EQ(1e-1, StringToDouble("1e-1", NO_FLAGS)); 204 CHECK_EQ(1e-1, StringToDouble("1e-1", NO_FLAGS));
208 CHECK_EQ(1e100, StringToDouble("1e+100", NO_FLAGS)); 205 CHECK_EQ(1e100, StringToDouble("1e+100", NO_FLAGS));
209 CHECK_EQ(1e-100, StringToDouble("1e-100", NO_FLAGS)); 206 CHECK_EQ(1e-100, StringToDouble("1e-100", NO_FLAGS));
210 CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS)); 207 CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS));
(...skipping 29 matching lines...) Expand all
240 CHECK(EightBit1::is_valid(i)); 237 CHECK(EightBit1::is_valid(i));
241 x = EightBit1::encode(i); 238 x = EightBit1::encode(i);
242 CHECK_EQ(i, EightBit1::decode(x)); 239 CHECK_EQ(i, EightBit1::decode(x));
243 CHECK(EightBit2::is_valid(i)); 240 CHECK(EightBit2::is_valid(i));
244 x = EightBit2::encode(i); 241 x = EightBit2::encode(i);
245 CHECK_EQ(i, EightBit2::decode(x)); 242 CHECK_EQ(i, EightBit2::decode(x));
246 } 243 }
247 CHECK(!EightBit1::is_valid(256)); 244 CHECK(!EightBit1::is_valid(256));
248 CHECK(!EightBit2::is_valid(256)); 245 CHECK(!EightBit2::is_valid(256));
249 } 246 }
OLDNEW
« no previous file with comments | « src/third_party/dtoa/dtoa.c ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698