| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Chito Lapena <chito(at)webims(dot)com> |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: Floating point problem? |
| Date: | 2006-06-26 20:11:12 |
| Message-ID: | 22366.1151352672@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Chito Lapena <chito(at)webims(dot)com> writes:
> This has become more of a prominent problem as we've added more data
> integrity checks in our code... We are getting errors like the following
> from our debug output:
> EMP ID: 3 Ledger balance mismatch - record: 116.1 Ledger: 116.1 diff:
> 1.52588e-05
> record: float4
> ledger: float4
If you are expecting exact results, you should be using an exact
datatype, ie numeric. Floating-point calculations are inherently
inexact ... *especially* with float4, which only has about six
significant digits at best.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2006-06-26 20:12:40 | Re: BUG #2497: bug initdb |
| Previous Message | Alvaro Herrera | 2006-06-26 19:44:17 | Re: BUG #2497: bug initdb |