Re: division by zero - Mailing list pgsql-general

From Bruce Momjian
Subject Re: division by zero
Date
Msg-id 200303071934.h27JYZX15662@candle.pha.pa.us
Whole thread Raw
In response to division by zero  (Eric B.Ridge <ebr@tcdi.com>)
List pgsql-general
I think this caused by floating point signals being reported by the OS,
while integer operations don't have signals.  I suppose we could catch
the divide by zero easily.  Folks?

---------------------------------------------------------------------------

Eric B.Ridge wrote:
> I admit, I suck at math, but I really thought postgres would ERROR on
> this:
>
> foo=# select 1/0;
>   ?column?
> ----------
>          0
> (1 row)
>
> More surprising is that this does ERROR:
> foo=# select 1/0.0;
> ERROR:  division by zero on numeric
>
> Is this a bug, or do I need to go back to high school algebra?  "Both"
> is an acceptable answer.  :)
>
> eric
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: password method in pg_hba.conf fails
Next
From: Tom Lane
Date:
Subject: Re: pg_ctl -m fast failing?