BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION

From: "brad" <smithbs(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION
Date: 2011-02-10 23:38:56
Message-ID: 201102102338.p1ANcupQ035423@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5880
Logged by: brad
Email address: smithbs(at)gmail(dot)com
PostgreSQL version: 8.4.5
Operating system: linux x64
Description: Rounding error when copying a REAL numeric value to
DOUBLE PRECISION
Details:

Steps to recreate are below. The real value is improperly rounded when
inserted into a field that is double. 94.31 is stored as 94.3099975585938
when it is inserted into a double precision column.

CREATE TABLE tmpfloatToDouble
(field1 DOUBLE PRECISION,
field2 REAL);

INSERT INTO tmpfloatToDouble(field1, field2) VALUES(94.31, 94.31);
INSERT INTO tmpfloatToDouble(field1, field2) select field2, field1 FROM
tmpfloatToDouble;

SELECT * FROM tmpfloattodouble;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2011-02-11 02:59:01 Re: BUG #5879: PostgreSQL can not load my data folder
Previous Message Mauricio Agustin Roubineau 2011-02-10 22:38:34 BUG #5879: PostgreSQL can not load my data folder