Negative infinity and negative zero in numpy

Viewed 5164

This is more of a general understanding question

a = np.array([-0, 5, 0]).astype(float)
b = 1 / a
print b

returns [ inf 0.2 inf]

But

a = np.array([-0.0, 5, 0])
b = 1 / a
print b

returns [-inf 0.2 inf]

I expected the first one to return -inf for the first element as well, why doesn't it?

1 Answers
Related