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

Side by Side Diff: test/mjsunit/es6/math-fround.js

Issue 394833002: Ship ES6 Math functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | « test/mjsunit/es6/math-expm1.js ('k') | test/mjsunit/es6/math-hyperbolic.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-maths
6
7 // Monkey-patch Float32Array. 5 // Monkey-patch Float32Array.
8 Float32Array = function(x) { this[0] = 0; }; 6 Float32Array = function(x) { this[0] = 0; };
9 7
10 assertTrue(isNaN(Math.fround(NaN))); 8 assertTrue(isNaN(Math.fround(NaN)));
11 assertTrue(isNaN(Math.fround(function() {}))); 9 assertTrue(isNaN(Math.fround(function() {})));
12 assertTrue(isNaN(Math.fround({ toString: function() { return NaN; } }))); 10 assertTrue(isNaN(Math.fround({ toString: function() { return NaN; } })));
13 assertTrue(isNaN(Math.fround({ valueOf: function() { return "abc"; } }))); 11 assertTrue(isNaN(Math.fround({ valueOf: function() { return "abc"; } })));
14 assertEquals("Infinity", String(1/Math.fround(0))); 12 assertEquals("Infinity", String(1/Math.fround(0)));
15 assertEquals("-Infinity", String(1/Math.fround(-0))); 13 assertEquals("-Infinity", String(1/Math.fround(-0)));
16 assertEquals("Infinity", String(Math.fround(Infinity))); 14 assertEquals("Infinity", String(Math.fround(Infinity)));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 assertEquals(float.toSingle(), Math.fround(float.toDouble())); 88 assertEquals(float.toSingle(), Math.fround(float.toDouble()));
91 } 89 }
92 } 90 }
93 } 91 }
94 92
95 for (var sign = 0; sign < 2; sign++) { 93 for (var sign = 0; sign < 2; sign++) {
96 for (var exp = 1024 - 170; exp < 1024 + 170; exp++) { 94 for (var exp = 1024 - 170; exp < 1024 + 170; exp++) {
97 fuzz_mantissa(sign, exp, 1337 * exp - sign, 127913 * exp - sign); 95 fuzz_mantissa(sign, exp, 1337 * exp - sign, 127913 * exp - sign);
98 } 96 }
99 } 97 }
OLDNEW
« no previous file with comments | « test/mjsunit/es6/math-expm1.js ('k') | test/mjsunit/es6/math-hyperbolic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698