About 50 results
Open links in new tab
  1. Exponentials in python: x**y vs math.pow(x, y) - Stack Overflow

    Jan 7, 2014 · The established operator precedence in mathematics is that a unary minus is evaluated after exponentiation, so −2² = − (2²) = −4. There are good reasons for this, in particular coherence …

  2. math - How do I do exponentiation in python? - Stack Overflow

    Jan 8, 2017 · How do I do exponentiation in python? [duplicate] Asked 10 years, 9 months ago Modified 1 year, 5 months ago Viewed 95k times

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

    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. What does the power operator (**) in Python translate into?

    Jan 12, 2022 · The power operator has the same semantics as the built-in pow() function, when called with two arguments: it yields its left argument raised to the power of its right argument. This means …

  5. Why does Python `**` use for exponentiation instead of the `^` operator?

    Feb 23, 2018 · Why is ^ not squaring in Python? I know exponentiation is ** instead, but what exactly is ^ and why wasn't that operator used instead? For example 2^2=0, 3^2=1.

  6. What does the ** maths operator do in Python? - Stack Overflow

    57 It is the power operator. From the Python 3 docs: The power operator has the same semantics as the built-in pow () function, when called with two arguments: it yields its left argument raised to the power …

  7. Why is exponentiation applied right to left? - Stack Overflow

    Nov 22, 2017 · I am reading an Intro to Python textbook and came across this line: Operators on the same row have equal precedence and are applied left to right, except for exponentiation, which is …

  8. python - How can I use "e" (Euler's number) and power operation ...

    Aug 25, 2016 · How can I write 1-e^ (-value1^2/2*value2^2) in Python? I don't know how to use power operator and e.

  9. python - Creating a function to print the exponents without using ...

    Jul 11, 2020 · I'm tasked with writing a function in Python 3 to essentially recreate the ** command for the powers of 2, given a number (eg- if n = 10, print out 1,2,4...1024). I can't use any predefined …

  10. python - What does the caret (^) operator do? - Stack Overflow

    I ran across the caret operator in python today and trying it out, I got the following output: