Inconsistent results for division and multiplication operations - Mailing list pgsql-sql

From szy
Subject Inconsistent results for division and multiplication operations
Date
Msg-id tencent_59551086059D604A0E8C30A43A934D7D6906@qq.com
Whole thread Raw
Responses Re: Inconsistent results for division and multiplication operations
List pgsql-sql

Hi PostgreSQL community,

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

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

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

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



 

pgsql-sql by date:

Previous
From: Sam Stearns
Date:
Subject: Re: Postgres View DDL
Next
From: Erik Brandsberg
Date:
Subject: Re: Inconsistent results for division and multiplication operations