log(0) behaviour

After "from pylab import *", log(0.0) gives

Warning: Encountered divide by zero(s) in log

Where is this behaviour documented? What does it mean? Why should log(0.0) divide by zero? What does the plural "zeros" refer to? Why break the IEEE standard that log(0.0) should silently return -Inf?

Keith

PS: at http://matplotlib.sourceforge.net/pylab_commands.html, "it's size" should be "its size."

http://www.opengroup.org/onlinepubs/000095399/functions/log.html

Look at the section "ERRORS", specifically "Pole Error". By and large the
implementation of log() comes from the underlying libm. The plural is because
log() is a ufunc and can take arrays, possibly with multiple zeros.

···

keith.briggs@...644... wrote:

After "from pylab import *", log(0.0) gives

Warning: Encountered divide by zero(s) in log

Where is this behaviour documented? What does it mean? Why should log(0.0) divide by zero? What does the plural "zeros" refer to? Why break the IEEE standard that log(0.0) should silently return -Inf?

--
Robert Kern
robert.kern@...287...

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
  -- Umberto Eco

Adding to Robert's reply, I don't believe that the standard mandates that programs should silently return Inf in the presence of divide by zero errors. It does allow for programs to determine how they want to respond to such errors, and numpy allows you to customize that. You can ignore them, print a warning (the default I believe), or raise an exception. Believe it or not, not everyone wants the same behavior for all cases.

Perry

···

On Apr 25, 2006, at 6:59 AM, <keith.briggs@...644...> wrote:

After "from pylab import *", log(0.0) gives

Warning: Encountered divide by zero(s) in log

Where is this behaviour documented? What does it mean? Why should log(0.0) divide by zero? What does the plural "zeros" refer to? Why break the IEEE standard that log(0.0) should silently return -Inf?