Re: jdbc rounding value for numeric fields

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ioana Danes <ioanasoftware(at)yahoo(dot)ca>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc rounding value for numeric fields
Date: 2009-05-25 15:15:49
Message-ID: 3503.1243264549@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Ioana Danes <ioanasoftware(at)yahoo(dot)ca> writes:
> ps.setDouble(1,2.6999999999999997);

Don't use setDouble. float8 to numeric conversion only preserves
DBL_DIG (ie, 15 on standard platforms) decimal digits, since that's
the most that can be fully trusted in a float8 value.

regards, tom lane

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ioana Danes 2009-05-25 15:16:46 jdbc rounding value for numeric fields
Previous Message Ioana Danes 2009-05-25 14:59:53 jdbc rounding value for numeric fields