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

Side by Side Diff: test/mjsunit/parse-int-float.js

Issue 1367004: Optimization for parsing integers of limited length (in digits). (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 | « src/conversions.cc ('k') | 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 2008 the V8 project authors. All rights reserved. 1 // Copyright 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 29 matching lines...) Expand all
40 40
41 assertEquals(0x12, parseInt('0x12')); 41 assertEquals(0x12, parseInt('0x12'));
42 assertEquals(0x12, parseInt('0x12', 16)); 42 assertEquals(0x12, parseInt('0x12', 16));
43 assertEquals(0x12, parseInt('0x12', 16.1)); 43 assertEquals(0x12, parseInt('0x12', 16.1));
44 assertEquals(0x12, parseInt('0x12', NaN)); 44 assertEquals(0x12, parseInt('0x12', NaN));
45 45
46 assertEquals(12, parseInt('12aaa')); 46 assertEquals(12, parseInt('12aaa'));
47 47
48 assertEquals(0.1, parseFloat('0.1')); 48 assertEquals(0.1, parseFloat('0.1'));
49 assertEquals(0.1, parseFloat('0.1aaa')); 49 assertEquals(0.1, parseFloat('0.1aaa'));
50 assertEquals(0, parseFloat('0aaa'));
50 assertEquals(0, parseFloat('0x12')); 51 assertEquals(0, parseFloat('0x12'));
51 assertEquals(77, parseFloat('077')); 52 assertEquals(77, parseFloat('077'));
52 53
53 54
54 var i; 55 var i;
55 var y = 10; 56 var y = 10;
56 57
57 for (i = 1; i < 21; i++) { 58 for (i = 1; i < 21; i++) {
58 var x = eval("1.2e" + i); 59 var x = eval("1.2e" + i);
59 assertEquals(Math.floor(x), parseInt(x)); 60 assertEquals(Math.floor(x), parseInt(x));
(...skipping 16 matching lines...) Expand all
76 77
77 assertTrue(isNaN(parseInt(0/0))); 78 assertTrue(isNaN(parseInt(0/0)));
78 assertTrue(isNaN(parseInt(1/0)), "parseInt Infinity"); 79 assertTrue(isNaN(parseInt(1/0)), "parseInt Infinity");
79 assertTrue(isNaN(parseInt(-1/0)), "parseInt -Infinity"); 80 assertTrue(isNaN(parseInt(-1/0)), "parseInt -Infinity");
80 81
81 assertTrue(isNaN(parseFloat(0/0))); 82 assertTrue(isNaN(parseFloat(0/0)));
82 assertEquals(Infinity, parseFloat(1/0), "parseFloat Infinity"); 83 assertEquals(Infinity, parseFloat(1/0), "parseFloat Infinity");
83 assertEquals(-Infinity, parseFloat(-1/0), "parseFloat -Infinity"); 84 assertEquals(-Infinity, parseFloat(-1/0), "parseFloat -Infinity");
84 85
85 86
OLDNEW
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698