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

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

Issue 3744008: Work around Windows bug. Use different constants. (Closed)
Patch Set: Work around Windows bug. Use different constants.... Created 10 years, 2 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 | « 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 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "cctest.h" 7 #include "cctest.h"
8 #include "strtod.h" 8 #include "strtod.h"
9 9
10 using namespace v8::internal; 10 using namespace v8::internal;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 CHECK_EQ(123456789012345e-20, Strtod(vector, -20)); 147 CHECK_EQ(123456789012345e-20, Strtod(vector, -20));
148 CHECK_EQ(123456789012345e-22, Strtod(vector, -22)); 148 CHECK_EQ(123456789012345e-22, Strtod(vector, -22));
149 CHECK_EQ(123456789012345e-23, Strtod(vector, -23)); 149 CHECK_EQ(123456789012345e-23, Strtod(vector, -23));
150 CHECK_EQ(123456789012345e-25, Strtod(vector, -25)); 150 CHECK_EQ(123456789012345e-25, Strtod(vector, -25));
151 CHECK_EQ(123456789012345e-39, Strtod(vector, -39)); 151 CHECK_EQ(123456789012345e-39, Strtod(vector, -39));
152 152
153 CHECK_EQ(0.0, StrtodChar("0", 12345)); 153 CHECK_EQ(0.0, StrtodChar("0", 12345));
154 CHECK_EQ(0.0, StrtodChar("", 1324)); 154 CHECK_EQ(0.0, StrtodChar("", 1324));
155 CHECK_EQ(0.0, StrtodChar("000000000", 123)); 155 CHECK_EQ(0.0, StrtodChar("000000000", 123));
156 CHECK_EQ(0.0, StrtodChar("2", -324)); 156 CHECK_EQ(0.0, StrtodChar("2", -324));
157 CHECK_EQ(3e-324, StrtodChar("3", -324)); 157 CHECK_EQ(4e-324, StrtodChar("3", -324));
158 // It would be more readable to put non-zero literals on the left side (i.e. 158 // It would be more readable to put non-zero literals on the left side (i.e.
159 // CHECK_EQ(1e-325, StrtodChar("1", -325))), but then Gcc complains that 159 // CHECK_EQ(1e-325, StrtodChar("1", -325))), but then Gcc complains that
160 // they are truncated to zero. 160 // they are truncated to zero.
161 CHECK_EQ(0.0, StrtodChar("1", -325)); 161 CHECK_EQ(0.0, StrtodChar("1", -325));
162 CHECK_EQ(0.0, StrtodChar("1", -325)); 162 CHECK_EQ(0.0, StrtodChar("1", -325));
163 CHECK_EQ(0.0, StrtodChar("20000", -328)); 163 CHECK_EQ(0.0, StrtodChar("20000", -328));
164 CHECK_EQ(30000e-328, StrtodChar("30000", -328)); 164 CHECK_EQ(40000e-328, StrtodChar("30000", -328));
165 CHECK_EQ(0.0, StrtodChar("10000", -329)); 165 CHECK_EQ(0.0, StrtodChar("10000", -329));
166 CHECK_EQ(0.0, StrtodChar("90000", -329)); 166 CHECK_EQ(0.0, StrtodChar("90000", -329));
167 CHECK_EQ(0.0, StrtodChar("000000001", -325)); 167 CHECK_EQ(0.0, StrtodChar("000000001", -325));
168 CHECK_EQ(0.0, StrtodChar("000000001", -325)); 168 CHECK_EQ(0.0, StrtodChar("000000001", -325));
169 CHECK_EQ(0.0, StrtodChar("0000000020000", -328)); 169 CHECK_EQ(0.0, StrtodChar("0000000020000", -328));
170 CHECK_EQ(30000e-328, StrtodChar("00000030000", -328)); 170 CHECK_EQ(40000e-328, StrtodChar("00000030000", -328));
171 CHECK_EQ(0.0, StrtodChar("0000000010000", -329)); 171 CHECK_EQ(0.0, StrtodChar("0000000010000", -329));
172 CHECK_EQ(0.0, StrtodChar("0000000090000", -329)); 172 CHECK_EQ(0.0, StrtodChar("0000000090000", -329));
173 173
174 // It would be more readable to put the literals (and not V8_INFINITY) on the 174 // It would be more readable to put the literals (and not V8_INFINITY) on the
175 // left side (i.e. CHECK_EQ(1e309, StrtodChar("1", 309))), but then Gcc 175 // left side (i.e. CHECK_EQ(1e309, StrtodChar("1", 309))), but then Gcc
176 // complains that the floating constant exceeds range of 'double'. 176 // complains that the floating constant exceeds range of 'double'.
177 CHECK_EQ(V8_INFINITY, StrtodChar("1", 309)); 177 CHECK_EQ(V8_INFINITY, StrtodChar("1", 309));
178 CHECK_EQ(1e308, StrtodChar("1", 308)); 178 CHECK_EQ(1e308, StrtodChar("1", 308));
179 CHECK_EQ(1234e305, StrtodChar("1234", 305)); 179 CHECK_EQ(1234e305, StrtodChar("1234", 305));
180 CHECK_EQ(1234e304, StrtodChar("1234", 304)); 180 CHECK_EQ(1234e304, StrtodChar("1234", 304));
(...skipping 11 matching lines...) Expand all
192 CHECK_EQ(1234e304, StrtodChar("123400000", 299)); 192 CHECK_EQ(1234e304, StrtodChar("123400000", 299));
193 CHECK_EQ(V8_INFINITY, StrtodChar("180000000", 300)); 193 CHECK_EQ(V8_INFINITY, StrtodChar("180000000", 300));
194 CHECK_EQ(17e307, StrtodChar("170000000", 300)); 194 CHECK_EQ(17e307, StrtodChar("170000000", 300));
195 CHECK_EQ(V8_INFINITY, StrtodChar("00000001000000", 303)); 195 CHECK_EQ(V8_INFINITY, StrtodChar("00000001000000", 303));
196 CHECK_EQ(1e308, StrtodChar("000000000000100000", 303)); 196 CHECK_EQ(1e308, StrtodChar("000000000000100000", 303));
197 CHECK_EQ(1234e305, StrtodChar("00000000123400000", 300)); 197 CHECK_EQ(1234e305, StrtodChar("00000000123400000", 300));
198 CHECK_EQ(1234e304, StrtodChar("0000000123400000", 299)); 198 CHECK_EQ(1234e304, StrtodChar("0000000123400000", 299));
199 CHECK_EQ(V8_INFINITY, StrtodChar("00000000180000000", 300)); 199 CHECK_EQ(V8_INFINITY, StrtodChar("00000000180000000", 300));
200 CHECK_EQ(17e307, StrtodChar("00000000170000000", 300)); 200 CHECK_EQ(17e307, StrtodChar("00000000170000000", 300));
201 } 201 }
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