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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top