Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V1Fod-0001Bh-Qw for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jul 2013 13:06:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V1Foc-0000bh-Nr for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jul 2013 13:06:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V1FoY-0000Tw-EY for pgsql-bugs@postgresql.org; Mon, 22 Jul 2013 13:06:10 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V1FoV-0002ke-I9 for pgsql-bugs@postgresql.org; Mon, 22 Jul 2013 13:06:10 +0000 Received: from intern.anarazel.de (p5DDC66F1.dip0.t-ipconnect.de [93.220.102.241]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 05FFE4E8001; Mon, 22 Jul 2013 15:06:07 +0200 (CEST) Date: Mon, 22 Jul 2013 15:06:06 +0200 From: Andres Freund To: remi.cura@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double) Message-ID: <20130722130606.GD13444@alap2.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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