Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 5FFA49F9DF5 for ; Wed, 5 Sep 2007 11:07:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 69868-03-2 for ; Wed, 5 Sep 2007 11:07:41 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 162E29FA026 for ; Wed, 5 Sep 2007 11:07:46 -0300 (ADT) thread-index: Acfvxipb+KQjoqLYSUyqgYoJgisuVg== Received: from [172.24.32.97] ([62.232.55.118]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 5 Sep 2007 10:07:59 -0400 Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4073 Message-ID: <46DEB80F.40008@enterprisedb.com> Date: Wed, 05 Sep 2007 15:07:11 +0100 From: "Heikki Linnakangas" User-Agent: Icedove 1.5.0.12 (X11/20070730) MIME-Version: 1.0 To: "Peter Kovacs" Cc: Subject: Re: PreparedStatement rounds doubles to scale 14 during update References: <46DE7E7A.70208@enterprisedb.com> <46DE9C1F.6030407@enterprisedb.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 05 Sep 2007 14:07:59.0593 (UTC) FILETIME=[2A520590:01C7EFC6] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/22 X-Sequence-Number: 17444 Peter Kovacs wrote: > One last question: > > How come that Java double, which is an 8 byte size floating point > number, cannot fit in PostgreSQL's double precision type, which is > equally a floating point type and 8 bytes in size? Hmm. I'm not sure when the truncation happens. The value might actually still be intact when it's converted from text representation to double, and loses precision in the conversion from float8 to decimal. It's possible to have a floating point value in the database that you can't get out in text format without losing precision. Consider this for example: postgres=# SELECT '6.118992224252588'::float8, '6.11899222425259'::float8, '6.11899222425259'::float8 = '6.118992224252588'::float8; float8 | float8 | ?column? ------------------+------------------+---------- 6.11899222425259 | 6.11899222425259 | f (1 row) Both values are rounded to the same value on output, but if you compare them, they're actually not equal. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com