summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Number/prototype/toExponential
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Number/prototype/toExponential')
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/infinity.js30
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/length.js31
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/name.js28
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/nan.js23
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/prop-desc.js19
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/range.js21
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits-symbol.js23
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits.js36
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/return-values.js57
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-0.js36
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-not-0.js42
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/this-type-not-number-or-number-object.js69
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/tointeger-fractiondigits.js36
-rw-r--r--js/src/tests/test262/built-ins/Number/prototype/toExponential/undefined-fractiondigits.js40
17 files changed, 526 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/browser.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/browser.js
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/infinity.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/infinity.js
new file mode 100644
index 0000000000..b9870e5902
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/infinity.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return signed Infinity string if this is Infinity
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ [...]
+ 5. Let s be the empty String.
+ 6. If x < 0, then
+ a. Let s be "-".
+ b. Let x be -x.
+ 7. If x = +∞, then
+ a. Return the concatenation of the Strings s and "Infinity".
+ [...]
+---*/
+
+assert.sameValue((+Infinity).toExponential(1000), "Infinity", "Infinity value");
+var n = new Number(+Infinity);
+assert.sameValue(n.toExponential(1000), "Infinity", "Number Infinity");
+
+assert.sameValue((-Infinity).toExponential(1000), "-Infinity", "-Infinity value");
+var n = new Number(-Infinity);
+assert.sameValue(n.toExponential(1000), "-Infinity", "Number -Infinity");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/length.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/length.js
new file mode 100644
index 0000000000..0c146d1500
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/length.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.1.3.2
+description: >
+ Number.prototype.toExponential.length is 1.
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Number.prototype.toExponential.length, 1);
+
+verifyNotEnumerable(Number.prototype.toExponential, "length");
+verifyNotWritable(Number.prototype.toExponential, "length");
+verifyConfigurable(Number.prototype.toExponential, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/name.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/name.js
new file mode 100644
index 0000000000..a92b59ba75
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 20.1.3.2
+description: >
+ Number.prototype.toExponential.name is "toExponential".
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(Number.prototype.toExponential.name, "toExponential");
+
+verifyNotEnumerable(Number.prototype.toExponential, "name");
+verifyNotWritable(Number.prototype.toExponential, "name");
+verifyConfigurable(Number.prototype.toExponential, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/nan.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/nan.js
new file mode 100644
index 0000000000..0a5e46535c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/nan.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return "NaN" if this is NaN
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ 2. Let f be ? ToInteger(fractionDigits).
+ 3. Assert: f is 0, when fractionDigits is undefined.
+ 4. If x is NaN, return the String "NaN".
+ [...]
+---*/
+
+assert.sameValue(NaN.toExponential(Infinity), "NaN", "NaN value");
+
+var n = new Number(NaN);
+assert.sameValue(n.toExponential(NaN), "NaN", "NaN obj");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/not-a-constructor.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/not-a-constructor.js
new file mode 100644
index 0000000000..bbf60fe972
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Number.prototype.toExponential does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(Number.prototype.toExponential),
+ false,
+ 'isConstructor(Number.prototype.toExponential) must return false'
+);
+
+assert.throws(TypeError, () => {
+ new Number.prototype.toExponential();
+}, '`new Number.prototype.toExponential()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/prop-desc.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/prop-desc.js
new file mode 100644
index 0000000000..9e66b6c426
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ "toExponential" property of Number.prototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(Number.prototype, "toExponential");
+verifyWritable(Number.prototype, "toExponential");
+verifyConfigurable(Number.prototype, "toExponential");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/range.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/range.js
new file mode 100644
index 0000000000..32f36b1ea5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/range.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: Number.prototype.toExponential permits fractionDigits from 0 to 100
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ ...
+ 8. If _p_ &lt; 0 or _p_ &gt; 100, throw a *RangeError* exception.
+ ...
+---*/
+
+assert.sameValue((3).toExponential(0), "3e+0");
+assert.throws(RangeError, () => (3).toExponential(-1));
+
+assert.sameValue((3).toExponential(100), "3.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+0");
+assert.throws(RangeError, () => (3).toExponential(101));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits-symbol.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits-symbol.js
new file mode 100644
index 0000000000..a281c9282d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits-symbol.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return abrupt completion from ToInteger(symbol fractionDigits)
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ 2. Let f be ? ToInteger(fractionDigits).
+ [...]
+features: [Symbol]
+---*/
+
+var fd = Symbol("1");
+
+assert.throws(TypeError, function() {
+ NaN.toExponential(fd);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits.js
new file mode 100644
index 0000000000..481033a58e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-abrupt-tointeger-fractiondigits.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return abrupt completion from ToInteger(fractionDigits)
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ 2. Let f be ? ToInteger(fractionDigits).
+ [...]
+---*/
+
+var fd1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var fd2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ NaN.toExponential(fd1);
+}, "valueOf");
+
+assert.throws(Test262Error, function() {
+ NaN.toExponential(fd2);
+}, "toString");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-values.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-values.js
new file mode 100644
index 0000000000..a9e15c87a9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/return-values.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return regular string values
+---*/
+
+assert.sameValue((123.456).toExponential(0), "1e+2");
+assert.sameValue((123.456).toExponential(1), "1.2e+2");
+assert.sameValue((123.456).toExponential(2), "1.23e+2");
+assert.sameValue((123.456).toExponential(3), "1.235e+2");
+assert.sameValue((123.456).toExponential(4), "1.2346e+2");
+assert.sameValue((123.456).toExponential(5), "1.23456e+2");
+assert.sameValue((123.456).toExponential(6), "1.234560e+2");
+assert.sameValue((123.456).toExponential(7), "1.2345600e+2");
+assert.sameValue((123.456).toExponential(17), "1.23456000000000003e+2");
+assert.sameValue((123.456).toExponential(20), "1.23456000000000003070e+2");
+
+assert.sameValue((-123.456).toExponential(0), "-1e+2");
+assert.sameValue((-123.456).toExponential(1), "-1.2e+2");
+assert.sameValue((-123.456).toExponential(2), "-1.23e+2");
+assert.sameValue((-123.456).toExponential(3), "-1.235e+2");
+assert.sameValue((-123.456).toExponential(4), "-1.2346e+2");
+assert.sameValue((-123.456).toExponential(5), "-1.23456e+2");
+assert.sameValue((-123.456).toExponential(6), "-1.234560e+2");
+assert.sameValue((-123.456).toExponential(7), "-1.2345600e+2");
+assert.sameValue((-123.456).toExponential(17), "-1.23456000000000003e+2");
+assert.sameValue((-123.456).toExponential(20), "-1.23456000000000003070e+2");
+
+assert.sameValue((0.0001).toExponential(0), "1e-4");
+assert.sameValue((0.0001).toExponential(1), "1.0e-4");
+assert.sameValue((0.0001).toExponential(2), "1.00e-4");
+assert.sameValue((0.0001).toExponential(3), "1.000e-4");
+assert.sameValue((0.0001).toExponential(4), "1.0000e-4");
+assert.sameValue((0.0001).toExponential(16), "1.0000000000000000e-4");
+assert.sameValue((0.0001).toExponential(17), "1.00000000000000005e-4");
+assert.sameValue((0.0001).toExponential(18), "1.000000000000000048e-4");
+assert.sameValue((0.0001).toExponential(19), "1.0000000000000000479e-4");
+assert.sameValue((0.0001).toExponential(20), "1.00000000000000004792e-4");
+
+assert.sameValue((0.9999).toExponential(0), "1e+0");
+assert.sameValue((0.9999).toExponential(1), "1.0e+0");
+assert.sameValue((0.9999).toExponential(2), "1.00e+0");
+assert.sameValue((0.9999).toExponential(3), "9.999e-1");
+assert.sameValue((0.9999).toExponential(4), "9.9990e-1");
+assert.sameValue((0.9999).toExponential(16), "9.9990000000000001e-1");
+assert.sameValue((0.9999).toExponential(17), "9.99900000000000011e-1");
+assert.sameValue((0.9999).toExponential(18), "9.999000000000000110e-1");
+assert.sameValue((0.9999).toExponential(19), "9.9990000000000001101e-1");
+assert.sameValue((0.9999).toExponential(20), "9.99900000000000011013e-1");
+
+assert.sameValue((25).toExponential(0), "3e+1");
+assert.sameValue((12345).toExponential(3), "1.235e+4");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/shell.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/shell.js
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-0.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-0.js
new file mode 100644
index 0000000000..da4fafacd1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-0.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return "0" if this value is 0 and ToInteger(fractionDigits) is 0
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ [...]
+ 9. If x = 0, then
+ a. Let m be the String consisting of f+1 occurrences of the code unit 0x0030
+ (DIGIT ZERO).
+ b. Let e be 0.
+ [...]
+ 11. If f ≠ 0, then
+ [...]
+ 12. If e = 0, then
+ a. Let c be "+".
+ b. Let d be "0".
+ [...]
+ 14. Let m be the concatenation of the four Strings m, "e", c, and d.
+ 15. Return the concatenation of the Strings s and m.
+---*/
+
+assert.sameValue(Number.prototype.toExponential(0), "0e+0", "Number.prototype");
+
+assert.sameValue((0).toExponential(0), "0e+0", "(0).toExponential(0)");
+assert.sameValue((-0).toExponential(0), "0e+0", "(-0).toExponential(0)");
+
+assert.sameValue((0).toExponential(-0), "0e+0", "(0).toExponential(-0)");
+assert.sameValue((-0).toExponential(-0), "0e+0", "(-0).toExponential(-0)");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-not-0.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-not-0.js
new file mode 100644
index 0000000000..0fbdf1bc42
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-is-0-fractiondigits-is-not-0.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Return string value for this value = 0 and fractionDigits != 0
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ [...]
+ 9. If x = 0, then
+ a. Let m be the String consisting of f+1 occurrences of the code unit 0x0030
+ (DIGIT ZERO).
+ b. Let e be 0.
+ [...]
+ 11. If f ≠ 0, then
+ a. Let a be the first element of m, and let b be the remaining f elements of m.
+ b. Let m be the concatenation of the three Strings a, ".", and b.
+ 12. If e = 0, then
+ a. Let c be "+".
+ b. Let d be "0".
+ [...]
+ 14. Let m be the concatenation of the four Strings m, "e", c, and d.
+ 15. Return the concatenation of the Strings s and m.
+---*/
+
+assert.sameValue((0).toExponential(1), "0.0e+0", "0 and 1");
+assert.sameValue((0).toExponential(2), "0.00e+0", "0 and 2");
+assert.sameValue((0).toExponential(7), "0.0000000e+0", "0 and 7");
+assert.sameValue((0).toExponential(20), "0.00000000000000000000e+0", "0 and 20");
+
+assert.sameValue((-0).toExponential(1), "0.0e+0", "-0 and 1");
+assert.sameValue((-0).toExponential(2), "0.00e+0", "-0 and 2");
+assert.sameValue((-0).toExponential(7), "0.0000000e+0", "-0 and 7");
+assert.sameValue((-0).toExponential(20), "0.00000000000000000000e+0", "-0 and 20");
+
+assert.sameValue((0.0).toExponential(4), "0.0000e+0", "0.0 and 4");
+assert.sameValue((-0.0).toExponential(4), "0.0000e+0", "-0.0 and 4");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-type-not-number-or-number-object.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-type-not-number-or-number-object.js
new file mode 100644
index 0000000000..30987186be
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/this-type-not-number-or-number-object.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Throws a TypeError if this value is not a number object or value
+info: |
+ 20.1.3 Properties of the Number Prototype Object
+
+ The Number prototype object is the intrinsic object %NumberPrototype%. The
+ Number prototype object is an ordinary object. The Number prototype is itself
+ a Number object; it has a [[NumberData]] internal slot with the value +0.
+
+ [...]
+ The abstract operation thisNumberValue(value) performs the following steps:
+
+ 1. If Type(value) is Number, return value.
+ 2. If Type(value) is Object and value has a [[NumberData]] internal slot, then
+ a. Assert: value's [[NumberData]] internal slot is a Number value.
+ b. Return the value of value's [[NumberData]] internal slot.
+ 3. Throw a TypeError exception.
+
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ [...]
+features: [Symbol]
+---*/
+
+var toExponential = Number.prototype.toExponential;
+
+assert.throws(TypeError, function() {
+ toExponential.call({}, 1);
+}, "{}");
+
+assert.throws(TypeError, function() {
+ toExponential.call("1", 1);
+}, "string");
+
+assert.throws(TypeError, function() {
+ toExponential.call(Number, 1);
+}, "Number");
+
+assert.throws(TypeError, function() {
+ toExponential.call(true, 1);
+}, "true");
+
+assert.throws(TypeError, function() {
+ toExponential.call(false, 1);
+}, "false");
+
+assert.throws(TypeError, function() {
+ toExponential.call(null, 1);
+}, "null");
+
+assert.throws(TypeError, function() {
+ toExponential.call(undefined, 1);
+}, "undefined");
+
+assert.throws(TypeError, function() {
+ toExponential.call(Symbol("1"), 1);
+}, "symbol");
+
+assert.throws(TypeError, function() {
+ toExponential.call([], 1);
+}, "[]");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/tointeger-fractiondigits.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/tointeger-fractiondigits.js
new file mode 100644
index 0000000000..be496bde7f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/tointeger-fractiondigits.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ ToInteger(fractionDigits operations)
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ 2. Let f be ? ToInteger(fractionDigits).
+ [...]
+---*/
+
+assert.sameValue((123.456).toExponential(0.1), "1e+2", "0.1");
+assert.sameValue((123.456).toExponential(-0.1), "1e+2", "-0.1");
+assert.sameValue((123.456).toExponential(0.9), "1e+2", "0.9");
+assert.sameValue((123.456).toExponential(-0.9), "1e+2", "-0.9");
+
+assert.sameValue((123.456).toExponential(false), "1e+2", "false");
+assert.sameValue((123.456).toExponential(true), "1.2e+2", "true");
+
+assert.sameValue((123.456).toExponential(NaN), "1e+2", "NaN");
+assert.sameValue((123.456).toExponential(null), "1e+2", "null");
+
+assert.sameValue((123.456).toExponential("2"), "1.23e+2", "string");
+assert.sameValue((123.456).toExponential(""), "1e+2", "the empty string");
+
+assert.sameValue((123.456).toExponential([]), "1e+2", "[]");
+assert.sameValue((123.456).toExponential([2]), "1.23e+2", "[2]");
+
+assert.sameValue((0).toExponential(undefined), "0e+0", "undefined");
+assert.sameValue((0).toExponential(), "0e+0", "no arg");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Number/prototype/toExponential/undefined-fractiondigits.js b/js/src/tests/test262/built-ins/Number/prototype/toExponential/undefined-fractiondigits.js
new file mode 100644
index 0000000000..9194721ad6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Number/prototype/toExponential/undefined-fractiondigits.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 The V8 Project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-number.prototype.toexponential
+description: >
+ Handle undefined fractionDigits, not only casting it to 0
+info: |
+ Number.prototype.toExponential ( fractionDigits )
+
+ 1. Let x be ? thisNumberValue(this value).
+ 2. Let f be ? ToInteger(fractionDigits).
+ [...]
+ 10. Else x ≠ 0,
+ a. If fractionDigits is not undefined, then
+ i. Let e and n be integers such that 10f ≤ n < 10f+1 and for which the
+ exact mathematical value of n × 10e-f - x is as close to zero as
+ possible. If there are two such sets of e and n, pick the e and n for
+ which n × 10e-f is larger.
+ b. Else fractionDigits is undefined,
+ i. Let e, n, and f be integers such that f ≥ 0, 10f ≤ n < 10f+1, the
+ Number value for n × 10e-f is x, and f is as small as possible. Note
+ that the decimal representation of n has f+1 digits, n is not divisible
+ by 10, and the least significant digit of n is not necessarily uniquely
+ determined by these criteria.
+---*/
+
+assert.sameValue((123.456).toExponential(undefined), "1.23456e+2", "undefined");
+assert.sameValue((123.456).toExponential(), "1.23456e+2", "no arg");
+assert.sameValue((123.456).toExponential(0), "1e+2", "0");
+
+assert.sameValue((1.1e-32).toExponential(undefined), "1.1e-32", "undefined");
+assert.sameValue((1.1e-32).toExponential(), "1.1e-32", "no arg");
+assert.sameValue((1.1e-32).toExponential(0), "1e-32", "0");
+
+assert.sameValue((100).toExponential(undefined), "1e+2", "undefined");
+assert.sameValue((100).toExponential(), "1e+2", "no arg");
+assert.sameValue((100).toExponential(0), "1e+2", "0");
+
+reportCompare(0, 0);