Why don't NumPy floats give ZeroDivisionError?

Viewed 2095

I noticed that in the code:

import numpy as np    

a = 0.0
print a / a

b = np.array( [0.0] )
print b[0] / b[0]  

the first print function throws a ZeroDivisionError, but the second one outputs nan. I'm aware that type(b[0]) is numpy.float64, while type(a) is float. I have two questions:

1) Why was it implemented this way?

2) Is there anyway to have it throw a ZeroDivisionError?

3 Answers
Related