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

Side by Side Diff: test/mjsunit/harmony/math-cbrt.js

Issue 195123002: Harmony: move math features to es-staging. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: done Created 6 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --harmony-maths
6
7 assertTrue(isNaN(Math.cbrt(NaN)));
8 assertTrue(isNaN(Math.cbrt(function() {})));
9 assertTrue(isNaN(Math.cbrt({ toString: function() { return NaN; } })));
10 assertTrue(isNaN(Math.cbrt({ valueOf: function() { return "abc"; } })));
11 assertEquals("Infinity", String(1/Math.cbrt(0)));
12 assertEquals("-Infinity", String(1/Math.cbrt(-0)));
13 assertEquals("Infinity", String(Math.cbrt(Infinity)));
14 assertEquals("-Infinity", String(Math.cbrt(-Infinity)));
15
16 for (var i = 1E-100; i < 1E100; i *= Math.PI) {
17 assertEqualsDelta(i, Math.cbrt(i*i*i), i * 1E-15);
18 }
19
20 for (var i = -1E-100; i > -1E100; i *= Math.E) {
21 assertEqualsDelta(i, Math.cbrt(i*i*i), -i * 1E-15);
22 }
23
24 // Let's be exact at least for small integers.
25 for (var i = 2; i < 10000; i++) {
26 assertEquals(i, Math.cbrt(i*i*i));
27 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698