pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: brad <smithbs@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION
Date: Thu, 10 Feb 2011 23:38:56 GMT
Message-ID: <201102102338.p1ANcupQ035423@wwwmaster.postgresql.org> (raw)


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;



view thread (2+ messages)  latest in thread

Message-ID: <201102102338.p1ANcupQ035423@wwwmaster.postgresql.org>
Permalink:  ../201102102338.p1ANcupQ035423@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201102102338.p1ANcupQ035423@wwwmaster.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: smithbs@gmail.com
  Subject: Re: BUG #5880: Rounding error when copying a REAL numeric value to DOUBLE PRECISION
  In-Reply-To: <201102102338.p1ANcupQ035423@wwwmaster.postgresql.org>
  References: <201102102338.p1ANcupQ035423@wwwmaster.postgresql.org>

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

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