def test_compare_with_math_fsum(self):
# Compare with the math.fsum function.
# Ideally we ought to get the exact same result, but sometimes
# we differ by a very slight amount :-(
data = [random.uniform(-100, 1000) for _ in range(1000)]
self.assertApproxEqual(self.func(data), math.fsum(data), rel=2e-16)
评论列表
文章目录