Javascript Number negate()

Description

Javascript Number negate()


Number.prototype.negate = function ()
{
    "use strict";
    return -this;
};

for (var i = 1; i < 1e4; ++i)
    (4.24242).negate();/*from ww w.j  av  a2  s. c  om*/

Javascript Number negate()

Number.prototype.negate = function ()
{
    "use strict";
    return -this;
};

for (var i = 1; i < 1e4; ++i)
    (0xfffffff * 100000).negate();/* w  w w. j ava2s .  c  o  m*/

Javascript Number negate()

Number.prototype.negate = function ()
{
    "use strict";
    return -this;
};
noInline(Number.prototype.negate);

for (var i = 0; i < 1e4; ++i)
    (i % 3 === 0 ? -i : i).negate();/*from ww w .j av  a 2s . c  om*/

for (var i = 0; i < 1e4; ++i)
    ((i % 3 === 0 ? -i : i) * 0.2).negate();

for (var i = 0; i < 1e4; ++i)
    ((i % 3 === 0 ? -i : i) * 1000000).negate();

Number.prototype.negate.call(-20000);

for (var i = 0; i < 1e4; ++i)
    Number.prototype.negate.call(i % 2 === 0);



PreviousNext

Related