如何在python中获取浮点数的长版本? 由 为你痴迷发布于 2020-05-09 04:29:31 我正在尝试解决问题26,并且想知道如何显示浮点数的长版本。例如,如果我们有1/19,如何在python中获得64、128或更多的浮点数?
There are plenty of functions that allow you to handle the precision of a number in python. My personal favorite is
format()
. Example:yields the pi number with 12 significant digitsDocumentation on floating-point numbers.
请参见十进制数据类型。
https://docs.python.org/3/library/decimal.html