public inbox for [email protected]  
help / color / mirror / Atom feed
From: =?ISO-8859-1?B?c3p5?= <[email protected]>
To: =?ISO-8859-1?B?cGdzcWwtc3Fs?= <[email protected]>
Subject: Inconsistent results for division and multiplication operations
Date: Mon, 25 Nov 2024 23:46:28 +0800
Message-ID: <[email protected]> (raw)

Hi PostgreSQL community,


I have observed inconsistent results when performing division and multiplication operations in PostgreSQL.


postgres=# select 1.003/1.002*5.01;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;?column?
--------------------------
&nbsp;5.0149999999999999999806&nbsp;&nbsp;
(1 row)


postgres=# select 1.003*5.01/1.002;
&nbsp; &nbsp; &nbsp; ?column?
--------------------
&nbsp;5.0150000000000000
(1 row)


However, the expected result should be consistent for both queries. The actual results differ





szy
[email protected]



&nbsp;

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Inconsistent results for division and multiplication operations
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox