"Mark Dickinson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
On May 11, 9:36 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
|> Do you have in mind any situations in which it is advantageous to have 
0**0
|> undefined?

| (Playing devil's advocate here.) If you regard x**y as exp(y*log(x))

Which, of course, I was not, but for the sake of discussion....

| then it's not at all clear that 0.**0. should be considered well-defined.

Then it seems equally dubious that 0.**y, y>0, should be well-defined.
It seems to me that lim as x goes to 0. exp(y*log(x)) is equally well 
defined whether y is 0 or not, even though there is a discontinuity in the 
limit.
.
...
| The big problem here is that the power operation is really trying
| to combine two subtly different functionalities (integer powers
| and real powers), with quite distinct use-cases, into a single
| function.  Which leads to problems:  witness the mess that's
| C99's pow specification:  why does it make sense for (-2.0)**2.0 to
| return 4.0, while (-2.0)**1.999999999 returns NaN?

2.5 raises an exception.  In 3.0,
>>> (-2)**1.99999999
(3.9999999722741113-1.2566370355167477e-07j)

| Incidentally, the decimal module is slightly schizophrenic about this:

That module follows the IBM-led standard, no matter how crazy.

Terry Jan Reedy



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to