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

Side by Side Diff: test/mjsunit/es6/math-log1p.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-hypot.js ('k') | test/mjsunit/es6/math-log2-log10.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 assertTrue(isNaN(Math.log1p(NaN))); 5 assertTrue(isNaN(Math.log1p(NaN)));
8 assertTrue(isNaN(Math.log1p(function() {}))); 6 assertTrue(isNaN(Math.log1p(function() {})));
9 assertTrue(isNaN(Math.log1p({ toString: function() { return NaN; } }))); 7 assertTrue(isNaN(Math.log1p({ toString: function() { return NaN; } })));
10 assertTrue(isNaN(Math.log1p({ valueOf: function() { return "abc"; } }))); 8 assertTrue(isNaN(Math.log1p({ valueOf: function() { return "abc"; } })));
11 assertEquals("Infinity", String(1/Math.log1p(0))); 9 assertEquals("Infinity", String(1/Math.log1p(0)));
12 assertEquals("-Infinity", String(1/Math.log1p(-0))); 10 assertEquals("-Infinity", String(1/Math.log1p(-0)));
13 assertEquals("Infinity", String(Math.log1p(Infinity))); 11 assertEquals("Infinity", String(Math.log1p(Infinity)));
14 assertEquals("-Infinity", String(Math.log1p(-1))); 12 assertEquals("-Infinity", String(Math.log1p(-1)));
15 assertTrue(isNaN(Math.log1p(-2))); 13 assertTrue(isNaN(Math.log1p(-2)));
16 assertTrue(isNaN(Math.log1p(-Infinity))); 14 assertTrue(isNaN(Math.log1p(-Infinity)));
(...skipping 15 matching lines...) Expand all
32 } 30 }
33 var sum = 0; 31 var sum = 0;
34 while (terms.length > 0) sum += terms.pop(); 32 while (terms.length > 0) sum += terms.pop();
35 return sum; 33 return sum;
36 } 34 }
37 35
38 for (var x = 1E-1; x > 1E-300; x *= 0.8) { 36 for (var x = 1E-1; x > 1E-300; x *= 0.8) {
39 var expected = log1p(x); 37 var expected = log1p(x);
40 assertEqualsDelta(expected, Math.log1p(x), expected * 1E-14); 38 assertEqualsDelta(expected, Math.log1p(x), expected * 1E-14);
41 } 39 }
OLDNEW
« no previous file with comments | « test/mjsunit/es6/math-hypot.js ('k') | test/mjsunit/es6/math-log2-log10.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698