how can i show an irrational number to 100 decimal places in python?

后端 未结 4 1468
孤城傲影
孤城傲影 2020-12-03 03:38

I am trying to find the square root of 2 to 100 decimal places, but it only shows to like 10 by default, how can I change this?

4条回答
  •  甜味超标
    2020-12-03 03:58

    You can use sympy and evalf()

    from sympy import sqrt
    print(sqrt(2).evalf(101))
    

提交回复
热议问题