Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Math.sqrt(x * x) vs Math.sqrt(x ** 2)
(version: 1)
Benchmark.js
Math.sqrt(x * x) vs Math.sqrt(x ** 2)
Comparing performance of:
Math.sqrt(x * x) vs Math.sqrt(x ** 2)
Created:
5 months ago
by:
Guest
Go to the latest result
Script Preparation code:
const x = 123.456; const y = 789.123;
Tests:
Math.sqrt(x * x)
Math.sqrt(x * x + y * y); const z = Math.random() Math.sqrt(z * z);
Math.sqrt(x ** 2)
Math.sqrt(x ** 2 + y ** 2); const z = Math.random() Math.sqrt(z ** 2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Math.sqrt(x * x)
Math.sqrt(x ** 2)
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0
Browser/OS:
Chrome 148 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Math.sqrt(x * x)
49.6M/s
Math.sqrt(x ** 2)
49.6M/s
View exact numbers
Test name
Executions per second
✓
Math.sqrt(x * x)
49,646,084 Ops/sec
Math.sqrt(x ** 2)
49,592,280 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?