+ 6
Is math.sqrt(x) function faster than pow(x,.5)?
What are the implementations of both the functions? In what way one faster than the other?
5 Answers
+ 2
sqrt(2) is twice as fast as pow(2, .5) and 2**.5 is ten times faster than sqrt(2):
https://code.sololearn.com/cL4cLr3Ju12X
+ 6
pow is slightly faster, but x**y is the fastest
https://code.sololearn.com/c1fRKFT7ibw4/?ref=app
+ 3
there's also x**.5
Idk which is faster, but it's a good question, you made me curious, one of these days I'll use timeit to find out :)
+ 1
Ah, answered 3 times((
Many simple construction in python are quickly than difficult ones
For example, f and .format().
f is quickly and easier
0
ehh i think: x**5 will be fastest as it directly converted to c.