Re: Infinity vs Error for division by zero

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Matt Pulver <mpulver(at)unitytechgroup(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Infinity vs Error for division by zero
Date: 2019-03-01 17:59:42
Message-ID: 87lg1ycwbv.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Matt" == Matt Pulver <mpulver(at)unitytechgroup(dot)com> writes:

Matt> ERROR: division by zero

Matt> Question: If Infinity and NaN are supported, then why throw an
Matt> exception here, instead of returning Infinity?

Spec says so:

4) The dyadic arithmetic operators <plus sign>, <minus sign>,
<asterisk>, and <solidus> (+, -, *, and /, respectively) specify
addition, subtraction, multiplication, and division, respectively.
If the value of a divisor is zero, then an exception condition is
raised: data exception -- division by zero.

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2019-03-01 18:04:04 Re: Infinity vs Error for division by zero
Previous Message Matt Pulver 2019-03-01 17:46:55 Infinity vs Error for division by zero