function math operators

JavaScript performance comparison

Revision 2 of this test case created by Chris Richards

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
+
function add() { return Math.random() + Math.random(); }
pending…
-
function minus() { return Math.random() - Math.random(); }
pending…
*
function mult() { return Math.random() * Math.random(); }
pending…
/
function div() { return Math.random() / Math.random(); }
pending…
%
function mod() { return Math.random() % Math.random(); }
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:

2 comments

Scott Plumlee commented :

So what was the original theory, and could it be rooted in how random each browser tries to make the number?

Chris Richards (revision owner) commented :

Revision one I had the numbers static, but I changed it to Math.random() because I thought some browsers where caching the result.

Add a comment