Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Math/abs/absolute-value.js

raw
1 // Copyright (C) 2016 The V8 Project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-math.abs
6 es6id: 20.2.2.1
7 description: >
8 Returns the absolute value of x
9 info: |
10 Math.abs ( x )
11
12 Returns the absolute value of x; the result has the same magnitude as x but
13 has positive sign.
14 ---*/
15
16 assert.sameValue(Math.abs(-42), 42, "-42");
17 assert.sameValue(Math.abs(42), 42, "42");
18 assert.sameValue(Math.abs(-0.000001), 0.000001, "-0.000001");
19 assert.sameValue(Math.abs(0.000001), 0.000001, "0.000001");
20 assert.sameValue(Math.abs(-1e-17), 1e-17, "-1e-17");
21 assert.sameValue(Math.abs(1e-17), 1e-17, "1e-17");
22 assert.sameValue(Math.abs(-9007199254740991), 9007199254740991, "-(2**53-1)");
23 assert.sameValue(Math.abs(9007199254740991), 9007199254740991, "2**53-1");