Question

I want to know why does this code in Python

print gmpy.sqrt(2009)

give the result 44, and not 44.82186966... like i want it to do? How can i set the function to show me the decimal numbers.

Thank you in advance.

Était-ce utile?

La solution

Bluntly put, because it was defined that way. There is no way to set that option.

Edit: @casevh is correct: gmpy2.sqrt() returns what you want.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top