OLD | NEW |
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 CHECK_EQ(1234e305, StrtodChar("123400000", 300)); | 191 CHECK_EQ(1234e305, StrtodChar("123400000", 300)); |
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 CHECK_EQ(1.7976931348623157E+308, StrtodChar("17976931348623157", 292)); |
| 202 CHECK_EQ(1.7976931348623158E+308, StrtodChar("17976931348623158", 292)); |
| 203 CHECK_EQ(V8_INFINITY, StrtodChar("17976931348623159", 292)); |
201 | 204 |
202 // The following number is the result of 89255.0/1e-22. Both floating-point | 205 // The following number is the result of 89255.0/1e-22. Both floating-point |
203 // numbers can be accurately represented with doubles. However on Linux,x86 | 206 // numbers can be accurately represented with doubles. However on Linux,x86 |
204 // the floating-point stack is set to 80bits and the double-rounding | 207 // the floating-point stack is set to 80bits and the double-rounding |
205 // introduces an error. | 208 // introduces an error. |
206 CHECK_EQ(89255e-22, StrtodChar("89255", -22)); | 209 CHECK_EQ(89255e-22, StrtodChar("89255", -22)); |
| 210 CHECK_EQ(104110013277974872254e-225, |
| 211 StrtodChar("104110013277974872254", -225)); |
| 212 |
| 213 CHECK_EQ(123456789e108, StrtodChar("123456789", 108)); |
| 214 CHECK_EQ(123456789e109, StrtodChar("123456789", 109)); |
| 215 CHECK_EQ(123456789e110, StrtodChar("123456789", 110)); |
| 216 CHECK_EQ(123456789e111, StrtodChar("123456789", 111)); |
| 217 CHECK_EQ(123456789e112, StrtodChar("123456789", 112)); |
| 218 CHECK_EQ(123456789e113, StrtodChar("123456789", 113)); |
| 219 CHECK_EQ(123456789e114, StrtodChar("123456789", 114)); |
| 220 CHECK_EQ(123456789e115, StrtodChar("123456789", 115)); |
| 221 |
| 222 CHECK_EQ(1234567890123456789012345e108, |
| 223 StrtodChar("1234567890123456789012345", 108)); |
| 224 CHECK_EQ(1234567890123456789012345e109, |
| 225 StrtodChar("1234567890123456789012345", 109)); |
| 226 CHECK_EQ(1234567890123456789012345e110, |
| 227 StrtodChar("1234567890123456789012345", 110)); |
| 228 CHECK_EQ(1234567890123456789012345e111, |
| 229 StrtodChar("1234567890123456789012345", 111)); |
| 230 CHECK_EQ(1234567890123456789012345e112, |
| 231 StrtodChar("1234567890123456789012345", 112)); |
| 232 CHECK_EQ(1234567890123456789012345e113, |
| 233 StrtodChar("1234567890123456789012345", 113)); |
| 234 CHECK_EQ(1234567890123456789012345e114, |
| 235 StrtodChar("1234567890123456789012345", 114)); |
| 236 CHECK_EQ(1234567890123456789012345e115, |
| 237 StrtodChar("1234567890123456789012345", 115)); |
| 238 |
| 239 CHECK_EQ(1234567890123456789052345e108, |
| 240 StrtodChar("1234567890123456789052345", 108)); |
| 241 CHECK_EQ(1234567890123456789052345e109, |
| 242 StrtodChar("1234567890123456789052345", 109)); |
| 243 CHECK_EQ(1234567890123456789052345e110, |
| 244 StrtodChar("1234567890123456789052345", 110)); |
| 245 CHECK_EQ(1234567890123456789052345e111, |
| 246 StrtodChar("1234567890123456789052345", 111)); |
| 247 CHECK_EQ(1234567890123456789052345e112, |
| 248 StrtodChar("1234567890123456789052345", 112)); |
| 249 CHECK_EQ(1234567890123456789052345e113, |
| 250 StrtodChar("1234567890123456789052345", 113)); |
| 251 CHECK_EQ(1234567890123456789052345e114, |
| 252 StrtodChar("1234567890123456789052345", 114)); |
| 253 CHECK_EQ(1234567890123456789052345e115, |
| 254 StrtodChar("1234567890123456789052345", 115)); |
207 } | 255 } |
OLD | NEW |