Re: [Numpy-discussion] numpy.log does not raise exceptions

2011-08-28 Thread dpo
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

Re: [Numpy-discussion] numpy.log does not raise exceptions

2011-08-27 Thread Robert Kern
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)

[Numpy-discussion] numpy.log does not raise exceptions

2011-08-27 Thread Dominique Orban
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) ---