Search code examples
pythonsqrt

Gmpy sqrt precision


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.


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.