Robert Kern-2 wrote:
>
> The reason we don't raise exceptions by default is because when
> processing large arrays, you usually don't want to cancel the whole
> operation just because some values were out of the domain. You would
> rather get an array with NaNs in the elements that had invalid i
On Sat, Aug 27, 2011 at 15:09, Dominique Orban
wrote:
> 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)
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)
---