Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)

Поиск
Список
Период
Сортировка
От Rémi Cura
Тема Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)
Дата
Msg-id CAJvUf_uuVTrQb2R-WwJJ-2B-mphV9TLViWWvkQ7phfRWDUXH6w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: BUG #8317: ROUND(double*1/2) != ROUND(1/2*double)  (Kevin Grittner <kgrittn@ymail.com>)
Список pgsql-bugs
Hi, thanks for your quick answers.<br /><br />To close this non-bug : <br />According to the doc (<a
href="http://www.postgresql.org/docs/9.2/static/sql-syntax-lexical.html#SQL-SYNTAX-OPERATORS">http://www.postgresql.org/docs/9.2/static/sql-syntax-lexical.html#SQL-SYNTAX-OPERATORS</a>)<br
/>, multiplication has precedence on division. (I supposed it implicitely)<br />So anyway the query is parsed as ( 1/
(2*3.2))and ( 3.2*1) / 2 ), and so the behaviour is consistant.<br /><br />Cheers ,<br /><br />Rémi<br /><br /><div
class="gmail_quote">2013/7/22 Pavel Stehule <span dir="ltr"><<a href="mailto:pavel.stehule@gmail.com"
target="_blank">pavel.stehule@gmail.com</a>></span><br/><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px#ccc solid;padding-left:1ex"> 2013/7/22  <<a
href="mailto:remi.cura@gmail.com">remi.cura@gmail.com</a>>:<br/><div class="im">> The following bug has been
loggedon the website:<br /> ><br /> > Bug reference:      8317<br /> > Logged by:          Rémi<br /> >
Emailaddress:      <a href="mailto:remi.cura@gmail.com">remi.cura@gmail.com</a><br /> > PostgreSQL version: 9.2.4<br
/>> Operating system:   Ubuntu 12.0.4 32 bits hosted by a VirtualBox<br /> > Description:<br /> ><br /> >
Hello;<br/> > I ran into a strange behaviour.<br /> > Initially it showed in a group by, but is also happens in
regularselect :<br /> ><br /> ><br /> > example :<br /> > SELECT 2*ROUND(1/2*3.2)<br /> > --> gives
0<br/> > SELECT 2*ROUND(3.2*1/2)<br /> > --> gives 3<br /> ><br /> ><br /><br /></div>Hello<br /><br />
Itis not a bug - a reason for this behave is using a integer div in first case<br /><br /> ( 1 / 2 ) * 3.2 ... 1/2 ..
integerdiv, because left operand is int<br /> and right operand is int<br /> (3.2 * 1) / 2 ... 3.2 / 2 .. using numeric
div,left operand is<br /> numeric and right operand is int<br /><br /> Regards<br /><br /> Pavel Stehule<br /><div
class="im"><br/><br /><br /> > Obviously both should return the same thing, preferably 3.<br /> > It looks like a
bugto me, or at least a non desirable behaviour.<br /> ><br /> ><br /></div>> Cheers,<br /> > Rémi<br />
><br/> ><br /><span class="HOEnZb"><font color="#888888">><br /> > --<br /> > Sent via pgsql-bugs
mailinglist (<a href="mailto:pgsql-bugs@postgresql.org">pgsql-bugs@postgresql.org</a>)<br /> > To make changes to
yoursubscription:<br /> > <a href="http://www.postgresql.org/mailpref/pgsql-bugs"
target="_blank">http://www.postgresql.org/mailpref/pgsql-bugs</a><br/></font></span></blockquote></div><br /> 

В списке pgsql-bugs по дате отправления:

Предыдущее
От: g.bakalarski@icm.edu.pl
Дата:
Сообщение: BUG #8318: memory leak during CREATE TEMPORARY TABLE
Следующее
От: floriparob@gmail.com
Дата:
Сообщение: BUG #8324: Missing script