math.sqrt

trent shipley trent.shipley at gmail.com
Thu Apr 27 13:07:27 MST 2023


I'm on the bench at work, so I spend my days following along with examples
in Python books.  Whenever there is a choice to use  x**0.5 or math.sqrt(x)
the books opt for the square root option instead of the equivalent
representation as a fractional power.  Is the implementation of math.sqrt()
more efficient than x**0.5?  Is there a numerical shortcut to the value of
sqrt(x) that will make the sqrt symbol more efficient than the power
equivalent (x^0.5) in every programming language?

I have a math degree, and sometimes it is irksome since x**(1/2) or x^(1/2)
is symbolically more elegant in the formula.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20230427/9603abf7/attachment.htm>


More information about the PLUG-discuss mailing list