Skip site navigation (1) Skip section navigation (2)

Re: pgsql: Have numeric 0 ^ 4.3 return 1, rather than an error, and have 0 ^

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Have numeric 0 ^ 4.3 return 1, rather than an error, and have 0 ^
Date: 2008-05-08 22:34:20
Message-ID: 200805082234.m48MYK328302@momjian.us (view raw or flat)
Thread:
Lists: pgsql-committers
Tom Lane wrote:
> momjian(at)postgresql(dot)org (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

-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

In response to

Responses

pgsql-committers by date

Next:From: User AchernowDate: 2008-05-09 00:53:35
Subject: libpqtypes - libpqtypes: added copyright notices to all source files
Previous:From: Tom LaneDate: 2008-05-08 22:23:31
Subject: Re: pgsql: Have numeric 0 ^ 4.3 return 1, rather than an error, and have 0 ^

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group