testing math.round

Benchmark created on


Setup

console.time('1');
i=e;
while(i--){
  R1(3.5);
}
console.timeEnd('1')

Test runner

Ready to run.

Testing in
TestOps/sec
Custom Function
function R1(a,b=1){var c=a%b;return a-c+(c/b+1.5>>1)*b}
ready
Math
function R1(a){return Math.round(a)}
ready

Revisions

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