BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION - Mailing list pgsql-bugs

From brad
Subject BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION
Date
Msg-id 201102102338.p1ANcupQ035423@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5880
Logged by:          brad
Email address:      smithbs@gmail.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;

pgsql-bugs by date:

Previous
From: "Mauricio Agustin Roubineau"
Date:
Subject: BUG #5879: PostgreSQL can not load my data folder
Next
From: Craig Ringer
Date:
Subject: Re: BUG #5879: PostgreSQL can not load my data folder