Nodejs Number Negate negate()

Here you can find the source of negate()

Method Source Code

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   w w  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);

Related

  1. negate()
    Number.prototype.negate = function ()
        "use strict";
        return -this;
    };
    (4.24242).negate();
    
  2. negate()
    Number.prototype.negate = function ()
        "use strict";
        return -this;
    };
    for (var i = 1; i < 1e4; ++i)
        (0x424242).negate();
    
  3. negate()
    Number.prototype.negate = function ()
        "use strict";
        return -this;
    };
    (0xfffffff * 100000).negate();