Bug 885798 - Add ES6's Number.EPSILON. r=jwalden

This commit is contained in:
Till Schneidereit 2013-07-13 15:09:32 +02:00
parent 6e1a1a8f90
commit 6c43ecbfbd
2 changed files with 27 additions and 0 deletions

View File

@ -1001,6 +1001,7 @@ enum nc_slot {
NC_NEGATIVE_INFINITY,
NC_MAX_VALUE,
NC_MIN_VALUE,
NC_EPSILON,
NC_LIMIT
};
@ -1015,6 +1016,8 @@ 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 (May 2013 draft) 15.7.3.7 */
{2.2204460492503130808472633361816e-16, "EPSILON", 0,{0,0,0}},
{0,0,0,{0,0,0}}
};

View File

@ -0,0 +1,24 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 885798;
var summary = "ES6 (draft May 2013) 15.7.3.7 Number.EPSILON";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
// Test value
assertEq(Number.EPSILON, Math.pow(2, -52));
// Test property attributes
var descriptor = Object.getOwnPropertyDescriptor(Number, 'EPSILON');
assertEq(descriptor.writable, false);
assertEq(descriptor.configurable, false);
assertEq(descriptor.enumerable, false);
if (typeof reportCompare === "function")
reportCompare(true, true);