pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: remi.cura@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)
Date: Mon, 22 Jul 2013 15:06:06 +0200
Message-ID: <20130722130606.GD13444@alap2.anarazel.de> (raw)
In-Reply-To: <E1V1Cfq-00076T-El@wrigleys.postgresql.org>
References: <E1V1Cfq-00076T-El@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2013-07-22 09:44:58 +0000, remi.cura@gmail.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      8317
> Logged by:          Rémi
> Email address:      remi.cura@gmail.com
> PostgreSQL version: 9.2.4
> Operating system:   Ubuntu 12.0.4 32 bits hosted by a VirtualBox
> Description:        
> 
> Hello;
> I ran into a strange behaviour.
> Initially it showed in a group by, but is also happens in regular select :
> 
> 
> example :
> SELECT 2*ROUND(1/2*3.2)
> --> gives 0 
> SELECT 2*ROUND(3.2*1/2)
> --> gives 3
> 
> 
> Obviously both should return the same thing, preferably 3.
> It looks like a bug to me, or at least a non desirable behaviour.

Hm. Doesn't really look like a bug to me. The first parses as:
ROUND((1/2) * 3.2), the second as ROUND((3.2 * 1) / 2). So the different
result makes sense to me.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <20130722130606.GD13444@alap2.anarazel.de>
Permalink:  ../20130722130606.GD13444@alap2.anarazel.de/
Also on:    postgresql.org/message-id/20130722130606.GD13444@alap2.anarazel.de

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, remi.cura@gmail.com
  Subject: Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)
  In-Reply-To: <20130722130606.GD13444@alap2.anarazel.de>
  References: <E1V1Cfq-00076T-El@wrigleys.postgresql.org> <20130722130606.GD13444@alap2.anarazel.de>

* 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