mpmath
声称支持“任意精度浮点运算”。
但是 。. .
>>> import mpmath
>>> 1 + mpmath.erf(-5.921)
mpf('1.1102230246251565e-16')
>>> 1 + mpmath.erf(-5.922) # I expect a smaller positive number here.
mpf('0.0')
我错过了什么吗?或者这是一个基本的限制mpmath
?
@jonrsharpe 建议问题是我已经提交float
了erf
. 但是,下面的代码表明这不是问题:
>>> 1 + mpmath.erf(mpmath.mpf('-5.922'))
mpf('0.0')