Skip site navigation (1) Skip section navigation (2)

Re: Floating point problem?

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 (view raw or flat)
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

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-06-26 20:12:40
Subject: Re: BUG #2497: bug initdb
Previous:From: Alvaro HerreraDate: 2006-06-26 19:44:17
Subject: Re: BUG #2497: bug initdb

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group