Numpy没有以科学记数法精确打印数组

时间:2021-05-02 19:28:14

标签: python arrays numpy scientific-notation

我正在尝试将矩阵的所有条目与一个带有许多小数位的数字相乘。但是 numpy 不断返回四舍五入的值而不是科学记数法中的精确值......例如它应该是 d*g0[0] = -0.59999...但它直接返回 -0.6

g1 = np.array([5.61608209, 426.8222385])
g2 = np.array([43.76305474, 325.09697808])

g0 = g1-g2
print(g0) # returns [-38.14697265 101.72526042]

d = 0.01572863999999998
g = d * g0
print(g) # returns [-0.6  1.6]

我已经看到 numpy.around() 和 numpy.set_printoptions() 具有抑制和精度。但这些都是为了以十进制格式打印输出,如果我想要 numpy 使其更精确和科学记数法怎么办?

感谢任何帮助,提前致谢!

0 个答案:

没有答案
相关问题