[Numpy-discussion] numpy.log does not raise exceptions
Dominique Orban
dominique.orban at gmail.com
Sat Aug 27 16:09:11 EDT 2011
Hi,
I'm wondering why numpy.log doesn't raise a ValueError exception the
way math.log does:
1< import numpy as np
2< np.log([-1])
Warning: invalid value encountered in log
2> array([ nan])
3< import math
4< math.log(-1)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
It would make it a lot easier to trap domain errors than using isnan().
Thanks,
--
Dominique
More information about the NumPy-Discussion
mailing list