Debian Codegraph @

js/src/tests/test262/built-ins/Number/S9.3.1_A32.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 Once the exact MV for a string numeric literal has been
7 determined, it is then rounded to a value of the Number type with 20
8 significant digits by replacing each significant digit after the 20th
9 with a 0 digit or the number value
10 es5id: 9.3.1_A32
11 description: Use various long numbers, for example, 1234567890.1234567890
12 ---*/
13 assert.sameValue(
14 Number("1234567890.1234567890"),
15 1234567890.1234567890,
16 'Number("1234567890.1234567890") must return 1234567890.1234567890'
17 );
18
19 assert.sameValue(
20 Number("1234567890.1234567890"),
21 1234567890.1234567000,
22 'Number("1234567890.1234567890") must return 1234567890.1234567000'
23 );
24
25 assert.notSameValue(
26 +("1234567890.1234567890"),
27 1234567890.123456,
28 'The value of +("1234567890.1234567890") is not 1234567890.123456'
29 );
30
31 assert.sameValue(
32 Number("0.12345678901234567890"),
33 0.123456789012345678,
34 'Number("0.12345678901234567890") must return 0.123456789012345678'
35 );
36
37 assert.sameValue(
38 Number("00.12345678901234567890"),
39 0.123456789012345678,
40 'Number("00.12345678901234567890") must return 0.123456789012345678'
41 );
42
43 reportCompare(0, 0);