

|
 |
| << Topic |
< Post |
Post 6 of 11 Topic 16074 of 17070
|
Post > |
Topic >> |
Re: pgsql: Have numeric 0 ^ 4.3 return 1, rather than
by simon@[EMAIL PROTECTED]
(Simon Riggs)
May 9, 2008 at 09:00 AM
| On Thu, 2008-05-08 at 18:34 -0400, Bruce Momjian wrote:
> Tom Lane wrote:
> > momjian@[EMAIL PROTECTED]
(Bruce Momjian) writes:
> > > Have numeric 0 ^ 4.3 return 1, rather than an error, and have 0 ^
0.0
> > > return 1, rather than error.
> >
> > This is wrongly described, and the implementation is still not correct
> > either, because it should throw an error for negative exponents.
> > Would you please *read* that wikipedia page you keep citing?
> > http://en.wikipedia.org/wiki/Exponentiation#Powers_of_zero
>
> I think this is fixed in the version I just committed:
>
> test=> select 0 ^ (-1);
> ERROR: invalid argument for power function
> test=> select 0 ^ (-1.0);
> ERROR: invalid argument for power function
Hopefully this only occurs for 0 ^ (n)? A negative exponent isn't a
problem for y ^ x when y <> 0 and x < 0. Just checking you don't just
throw out an error for any negative exponent, which is what "invalid
argument" sounds like, to me.
Wikipedia says that exponentiation of zero to a negative power implies
division by zero, so shouldn't we throw a "division by zero" error?
--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com
--
Sent via pgsql-committers mailing list (pgsql-committers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


|
11 Posts in Topic:
|
momjian@[EMAIL PROTECTED] |
2008-05-08 19:25:38 |
|
neilc@[EMAIL PROTECTED]
|
2008-05-08 14:00:35 |
|
bruce@[EMAIL PROTECTED]
|
2008-05-08 18:18:00 |
|
tgl@[EMAIL PROTECTED]
(T |
2008-05-08 18:23:31 |
|
bruce@[EMAIL PROTECTED]
|
2008-05-08 18:34:20 |
|
simon@[EMAIL PROTECTED]
|
2008-05-09 09:00:36 |
|
tgl@[EMAIL PROTECTED]
(T |
2008-05-09 10:37:07 |
|
bruce@[EMAIL PROTECTED]
|
2008-05-09 11:36:07 |
|
tgl@[EMAIL PROTECTED]
(T |
2008-05-09 11:57:42 |
|
bruce@[EMAIL PROTECTED]
|
2008-05-09 11:58:41 |
|
bruce@[EMAIL PROTECTED]
|
2008-05-09 17:32:26 |
|
Post A Reply:

|
|
|
|