pythagoras

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
fast
const x = Math.random() - Math.random();
const y = Math.random() - Math.random();

const dist2 = x * x + y * y

const res = dist2 < 0.25;
ready
sqrt
const x = Math.random() - Math.random();
const y = Math.random() - Math.random();

const dist = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));

const res = dist < 0.5;
ready

Revisions

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