pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: Rémi Cura <remi.cura@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)
Date: Tue, 30 Jul 2013 14:17:36 -0700 (PDT)
Message-ID: <1375219056.72045.YahooMailNeo@web162903.mail.bf1.yahoo.com> (raw)
In-Reply-To: <CAJvUf_uuVTrQb2R-WwJJ-2B-mphV9TLViWWvkQ7phfRWDUXH6w@mail.gmail.com>
References: <E1V1Cfq-00076T-El@wrigleys.postgresql.org>
	<CAFj8pRB9FTO24A0rJ1jrd_NUaBKUhxoxbW-2-bdQwuFQxemG4w@mail.gmail.com>
	<CAJvUf_uuVTrQb2R-WwJJ-2B-mphV9TLViWWvkQ7phfRWDUXH6w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Rémi Cura <remi.cura@gmail.com> wrote:

> According to the doc
> ( http://www.postgresql.org/docs/9.2/static/sql-syntax-lexical.html#SQL-SYNTAX-OPERATORS ),
> multiplication has precedence on division. (I supposed it implicitely)

The correct link is:

http://www.postgresql.org/docs/9.2/static/sql-syntax-lexical.html#SQL-PRECEDENCE-TABLE

And it shows multiplication, division, and modulo as having equal
precedence, with left-to-right associativity.

> So anyway the query is parsed as ( 1/ (2*3.2)) and ( 3.2*1) / 2 ),

No, it is ((1 / 2) * 3.2) and ((3.2 * 1) / 2).

Those evaluate to (0 * 3.2) and (3.2 / 2), respectively.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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)

Message-ID: <1375219056.72045.YahooMailNeo@web162903.mail.bf1.yahoo.com>
Permalink:  ../1375219056.72045.YahooMailNeo@web162903.mail.bf1.yahoo.com/
Also on:    postgresql.org/message-id/1375219056.72045.YahooMailNeo@web162903.mail.bf1.yahoo.com

 · 

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: kgrittn@ymail.com, remi.cura@gmail.com, pavel.stehule@gmail.com
  Subject: Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)
  In-Reply-To: <1375219056.72045.YahooMailNeo@web162903.mail.bf1.yahoo.com>
  References: <E1V1Cfq-00076T-El@wrigleys.postgresql.org> <CAFj8pRB9FTO24A0rJ1jrd_NUaBKUhxoxbW-2-bdQwuFQxemG4w@mail.gmail.com> <CAJvUf_uuVTrQb2R-WwJJ-2B-mphV9TLViWWvkQ7phfRWDUXH6w@mail.gmail.com> <1375219056.72045.YahooMailNeo@web162903.mail.bf1.yahoo.com>

* 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