absolute-int (v2)

Revision 2 of this benchmark created on


Description

What's the fastest way of getting the absolute value of a negative integer?

Setup

var i = -5;

Test runner

Ready to run.

Testing in
TestOps/sec
tilde
~i+1;
ready
Math
Math.abs(i);
ready
timesequals
i*=-1;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.