Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Math.sqrt(x * x) vs Math.sqrt(x ** 2)
(version: 1)
Math.sqrt(x * x) vs Math.sqrt(x ** 2)
Comparing performance of:
Math.sqrt(x * x) vs Math.sqrt(x ** 2)
Created:
one month ago
by:
Guest
Jump 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:
21 days ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Safari/605.1.15
Browser/OS:
Safari 26 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Math.sqrt(x * x)
4898473.5 Ops/sec
Math.sqrt(x ** 2)
5233494.5 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?