Re: Divid by zero bug in float

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Divid by zero bug in float
Date: 2006-02-22 18:03:40
Message-ID: 20060222180340.GG77800@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 22, 2006 at 12:40:11PM -0500, Tom Lane wrote:
> "Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> > Shouldn't this produce Infinity instead of an error?
> > postgresql=# select 5::float/0::float;
> > ERROR: division by zero
>
> No, I don't think so. SQL92 6.12 <numeric value expression> quoth:
>
> 4) The dyadic arithmetic operators <plus sign>, <minus sign>, <as-
> terisk>, and <solidus> (+, -, *, and /, respectively) specify
> addition, subtraction, multiplication, and division, respec-
> tively. If the value of a divisor is zero, then an exception
> condition is raised: data exception-division by zero.
>
> There is nothing in there about allowing IEEE infinities instead, and
> I very strongly doubt that the average database user would expect such
> behavior.

Guess the spec is pretty clear then. Do you think it's worth mentioning
this in the floating point section of the docs?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-02-22 18:59:36 Re: Pgfoundry and gborg: shut one down
Previous Message Tom Lane 2006-02-22 17:40:11 Re: Divid by zero bug in float