• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15var big = 2147483646;
16
17big++;
18assert(big == 2147483647);
19
20big += 1;
21assert(big == 2147483648); // overflow on 32bit numbers
22
23big++;
24assert(big == 2147483649); // overflow on 32bit numbers
25
26assert ((1152921504606846976).toString() === "1152921504606847000");
27
28assert (1.797693134862315808e+308 === Infinity);
29
30assert (9999999999999999 == 10000000000000000);
31
32assert((9007199254740993).toString() === "9007199254740992");
33
34assert((9007199254740992).toString() === "9007199254740992");
35
36assert((9007199254740994).toString() === "9007199254740994");
37
38assert((1.00517e+21).toString() === "1.0051699999999999e+21");
39
40assert((1.00001e+21).toString() === "1.0000099999999999e+21");
41
42assert((9007199254740995).toString() === "9007199254740996");
43
44assert((18014398509481989).toString() === "18014398509481988");
45
46assert((18014398509481990).toString() === "18014398509481992");
47
48assert((18014398509481991).toString() === "18014398509481992");
49
50assert((18014398509481993).toString() === "18014398509481992");
51
52assert((18014398509481994).toString() === "18014398509481992");
53
54assert((18014398509481997).toString() === "18014398509481996");
55
56assert((18014398509481998).toString() === "18014398509482000");
57
58