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

Re: Divid by zero bug in float

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Divid by zero bug in float
Date: 2006-02-22 17:40:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
"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

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Jim C. NasbyDate: 2006-02-22 18:03:40
Subject: Re: Divid by zero bug in float
Previous:From: Jim C. NasbyDate: 2006-02-22 17:32:05
Subject: Divid by zero bug in float

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