From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Gray <gray(at)ms-irk(dot)ru>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5150: math bug |
Date: | 2009-10-31 03:29:29 |
Message-ID: | 22942.1256959769@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> In general, floating point arithmetic is inaccurate and sucky. That
> has nothing to do with PostgreSQL; it's just life.
Actually, I think these examples are being done in "numeric" not float8.
Your comment stands though --- 1.0/3.0 does not give the exact rational
number 1/3, but some finite decimal approximation to it, which when
multiplied by 3 will not produce exactly 1.0.
There is special-purpose software out there that can compute exactly
with rational numbers, but you aren't likely to find it embedded in any
general-purpose tools like databases --- the use-case just isn't wide
enough. One reason why not is that it'll still fall down on irrational
numbers.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-10-31 03:43:09 | Re: BUG #5155: Error compiling postgresql-8.5alpha2 |
Previous Message | Pierre | 2009-10-31 03:21:06 | BUG #5155: Error compiling postgresql-8.5alpha2 |