summaryrefslogtreecommitdiff
path: root/test/built-ins/Number/prototype/toExponential/range.js
blob: 8560ade75f8d7b5d2e694f855ea6fa1f261abb9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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_ < 0 or _p_ > 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));