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

    Jan 20, 2022 · 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? Why is math.sqrt () incorrect for large numbers? Python …

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

    In python 2.6 the (float).__pow__() function uses the C pow() function and the math.sqrt() functions uses the C sqrt() function. In glibc compiler the implementation of pow(x,y) is quite complex and it is well …

  3. Exponentiation in Python - should I prefer - Stack Overflow

    64 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 a different …

  4. 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 square. I tried u...

  5. 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 m (or …

  6. python - Which is more accurate, x**.5 or math.sqrt (x)? - Stack Overflow

    Sep 23, 2013 · I recently discovered that x**.5 and math.sqrt(x) do not always produce the same result in Python:

  7. python - Rounding ** 0.5 and math.sqrt - Stack Overflow

    Jun 7, 2013 · 3 Both **0.5 and math.sqrt() perform the calculation using floating point arithmetic. The input is converted to float before the square root is calculated. Do these calculations recognize when …

  8. python - "from math import sqrt" works but "import math" does not …

    Jun 4, 2015 · 7 I am pretty new in programming, just learning python. I'm using Komodo Edit 9.0 to write codes. So, when I write "from math import sqrt", I can use the "sqrt" function without any problem. …

  9. python - Using exponentiation **0.5 less efficient than math.sqrt ...

    A quote from "Python Programming: An Introduction to Computer Science" We could have taken the square root using exponentiation **. Using math.sqrt is somewhat more efficient. "Somewhat", but...

  10. python - Solving Quadratic Equation - Stack Overflow

    (-b + math.sqrt(b**2 - 4*a*c)) / (2 * a) Also, if you're already storing d, why not use it?