Re: math.sqrt

2023-04-27 Thread James Mcphee via PLUG-discuss
the implementation of math.sqrt could take advantage of anything specific to **0.5, ,while **0.x would have to be a generalist library. a compiler optimization could be used, but there would be the SLIGHT overhead of figuring out if the optimization could be used. if the optimizer even does it

math.sqrt

2023-04-27 Thread trent shipley via PLUG-discuss
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()