Py学习  »  Python

如何在python中使用八倍精度

sahasrara62 • 5 年前 • 1887 次点击  

我遇到这个问题是为了检查一个数是否可以被5整除。

我所做的许多解决方案之一是

def f(x):
     return x/5==x//5

我发现是由于浮点数错误。 IEEE_754#Basic_and_interchange_formats

在链接中,给定了二进制256(八倍精度)。

在python中没有发现任何有用的东西来实现它。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/53853
 
1887 次点击  
文章 [ 1 ]  |  最新文章 5 年前