我想分享一些在我的电脑上发生的事情。
在我的计算机上,不可能限制分母...
a = fr.Fraction(0.3)
a.limit_denominator(100)
print(a)Python给了我这样的结果:
5404319552844595/18014398509481984Screenshot of the results in using Jupyter Notebook
有没有人知道我的代码有问题,或者这是Python的问题?
Python版本: Python 3.8.2 (tag/v3.8.2:7b3ab59,Feb 25 2020,23:03:10)
IDE: VS Code,Jupyter
操作系统主机: Windows 10专业版-64位
提前感谢。
发布于 2020-05-25 03:25:55
limit_denominator返回一个新的分数。片段不应该被改变,并且片段公共API中的任何东西都不会改变片段。
https://stackoverflow.com/questions/61991249
复制相似问题