Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

I just want to know, What's the difference between x**(1/2), cmath.sqrt(), and math.sqrt()?

1 Answer

0 votes
by (26.4k points)

In the event that you take a gander at the documentation for cmath and math separately, you will find that:

  1. cmath "provides access to mathematical functions for complex numbers"
  2. math "functions cannot be used with complex numbers; use the functions of the same name from the cmath module if you require support for complex numbers."
  3. The (**) operator maps to the pow function, with the important difference that pow converts its arguments to float.

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...