From: SZUCS Gábor <surrano@mailbox.hu>
To: pgsql-sql@postgresql.org
Subject: Re: numeric and float converts to int differently?
Date: Tue, 28 Oct 2003 21:16:53 +0100
Message-ID: <0acb01c39d90$6d9d9080$0403a8c0@fejleszt4> (raw)
References: <072c01c39d65$65f83950$0403a8c0@fejleszt4>
<20031028154536.GA29427@it.is.rice.edu>
<074b01c39d72$6f512f90$0403a8c0@fejleszt4>
<87brs1gr4y.fsf@stark.dyndns.tv>
----- Original Message -----
From: "Greg Stark" <gsstark@mit.edu>
Sent: Tuesday, October 28, 2003 7:21 PM
> > > cannot see is that the float values are not actually exactly 0.5
> >
> > Yes I could guess that (floating point vs fixed), but is this a
coincidence
> > that both '0.5'::float and '-0.5'::float are closer to 0, whereas they
could
> > be closer to +/-1, as well as both closer to the lower or upper bound.
>
> Wouldn't 0.5 and -0.5 be representable exactly as floats?
As Tom pointed out, it isn't a floating point failure -- it is how rounding
float is implemented. I assume anything with less than 15 digits can be
exactly represented as float.
G.
------------------------------- cut here -------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: surrano@mailbox.hu
Subject: Re: numeric and float converts to int differently?
In-Reply-To: <0acb01c39d90$6d9d9080$0403a8c0@fejleszt4>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox