Rounding down

JavaScript performance comparison

Revision 111 of this test case created by Chen-Pang He

Info

Rounding down in all form possible

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var a = 89.938 / 293.3;
    var b = 83784 / 9289.2;
    var c = 7 / 60;
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Math.floor
Math.floor(a);
Math.floor(b);
Math.floor(c);
pending…
Bitwise OR
a | 0;
b | 0;
c | 0;
pending…
Bitwise shift
a >> 0;
b >> 0;
c >> 0;
pending…
Double NOT
~~a;
~~b;
~~c;
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment