зеркало из https://github.com/mozilla/gecko-dev.git
Bug 885798 - Add Number.{MAX,MIN}_SAFE_INTEGER. r=evilpie
--HG-- extra : rebase_source : 74a78f96d5b5951cc0ba4038ec35be0a5d0d2989
This commit is contained in:
Родитель
3f6a9ba557
Коммит
3b258ba0d5
|
@ -1095,6 +1095,10 @@ static JSConstDoubleSpec number_constants[] = {
|
|||
{0, "NEGATIVE_INFINITY", 0,{0,0,0}},
|
||||
{1.7976931348623157E+308, "MAX_VALUE", 0,{0,0,0}},
|
||||
{0, "MIN_VALUE", 0,{0,0,0}},
|
||||
/* ES6 (April 2014 draft) 20.1.2.6 */
|
||||
{9007199254740991, "MAX_SAFE_INTEGER", 0,{0,0,0}},
|
||||
/* ES6 (April 2014 draft) 20.1.2.10 */
|
||||
{-9007199254740991, "MIN_SAFE_INTEGER", 0,{0,0,0}},
|
||||
/* ES6 (May 2013 draft) 15.7.3.7 */
|
||||
{2.2204460492503130808472633361816e-16, "EPSILON", 0,{0,0,0}},
|
||||
{0,0,0,{0,0,0}}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
var BUGNUMBER = 885798;
|
||||
var summary = "ES6 (draft April 2014) 20.1.2.10 Number.MIN_SAFE_INTEGER";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
// Test value
|
||||
assertEq(Number.MIN_SAFE_INTEGER, -(Math.pow(2, 53) - 1));
|
||||
|
||||
//Test property attributes
|
||||
var descriptor = Object.getOwnPropertyDescriptor(Number, 'MIN_SAFE_INTEGER');
|
||||
|
||||
assertEq(descriptor.writable, false);
|
||||
assertEq(descriptor.configurable, false);
|
||||
assertEq(descriptor.enumerable, false);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
|
@ -0,0 +1,26 @@
|
|||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
var BUGNUMBER = 885798;
|
||||
var summary = "ES6 (draft April 2014) 20.1.2.6 Number.MAX_SAFE_INTEGER";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
// Test value
|
||||
assertEq(Number.MAX_SAFE_INTEGER, Math.pow(2, 53) - 1);
|
||||
|
||||
//Test property attributes
|
||||
var descriptor = Object.getOwnPropertyDescriptor(Number, 'MAX_SAFE_INTEGER');
|
||||
|
||||
assertEq(descriptor.writable, false);
|
||||
assertEq(descriptor.configurable, false);
|
||||
assertEq(descriptor.enumerable, false);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
Загрузка…
Ссылка в новой задаче