About 86,400 results
Open links in new tab
  1. math - How do I calculate square root in Python? - Stack Overflow

    Jan 20, 2022 · Related Integer square root in python How to find integer nth roots? Is there a short-hand for nth root of x in Python? Difference between ** (1/2), math.sqrt and cmath.sqrt? …

  2. performance - Which is faster in Python: x**.5 or math.sqrt (x ...

    There are at least 3 ways to do a square root in Python: math.sqrt, the '**' operator and pow (x,.5). I'm just curious as to the differences in the implementation of each of these. When it comes to …

  3. Exponentiation in Python - should I prefer ** operator instead of …

    math.sqrt is the C implementation of square root and is therefore different from using the ** operator which implements Python's built-in pow function. Thus, using math.sqrt actually gives …

  4. Difference between ** (1/2), math.sqrt and cmath.sqrt?

    Nov 13, 2015 · import math math.sqrt(x) just because of the lookup of sqrt in the math module. cmath is different and will be slower. It is for math on complex numbers, which is why it's …

  5. math - Integer square root in python - Stack Overflow

    Mar 13, 2013 · Is there an integer square root somewhere in python, or in standard libraries? I want it to be exact (i.e. return an integer), and raise an exception if the input isn't a perfect …

  6. Math module sqrt function python - Stack Overflow

    May 15, 2020 · Write a code segment that only imports sqrt from the math module. The code then prints out the square root for 81 and 9 respectively using the sqrt function math.sqrt(81)

  7. math - Is there a short-hand for nth root of x in Python ... - Stack ...

    There is. It's just ** =) Any nth root is an exponentiation by 1/n, so to get the square root of 9, you use 9**(1/2) (or 9**0.5) to get the cube root, you use 9 ** (1/3) (which we can't write with a …

  8. Python math module - Stack Overflow

    How are you importing math? I just tried import math and then math.sqrt which worked perfectly. Are you doing something like import math as m? If so, then you have to prefix the function with …

  9. В чем разница между разными способами извлечь корень в …

    Jul 19, 2021 · math.sqrt(x) по документации Python отсылка к типам double и IEEE 754. А реализовано средствами библиотеки C и/или POSIX.

  10. How to perform square root without using math module?

    Jun 15, 2010 · Importing the math module only happens once, and you probably won't get much faster than the math module. There is also an older Stackoverflow question regarding Which is …