From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Roman Kononov <kononov195-pgsql(at)yahoo(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [BUGS] BUG #2846: inconsistent and confusing |
Date: | 2006-12-28 01:41:23 |
Message-ID: | 200612280141.kBS1fN216423@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> Roman Kononov <kononov195-pgsql(at)yahoo(dot)com> writes:
> > In float4mul() and float4div(), the computation should be double precision.
>
> Why? It's going to have to fit in a float4 eventually anyway.
One issue is in the patch comment:
! * Computations that slightly exceed FLOAT8_MAX are non-Infinity,
! * but those that greatly exceed FLOAT8_MAX become Infinity. Therefore
! * it is difficult to tell if a value is really infinity or the result
! * of an overflow. The solution is to use a boolean indicating if
! * the input arguments were infiity, meaning an infinite result is
! * probably not the result of an overflow. This allows various
! * computations like SELECT 'Inf'::float8 + 5.
+ * Underflow has similar issues to overflow, i.e. if a computation is
+ * slighly smaller than FLOAT8_MIN, the result is non-zero, but if it is
+ * much smaller than FLOAT8_MIN, the value becomes zero. However,
+ * unlike overflow, zero is not a special value and can be the result
+ * of a computation, so there is no easy way to pass a boolean
+ * indicating whether a zero result is reasonable or not. It might
+ * be possible for multiplication and division, but because of rounding,
+ * such tests would probably not be reliable.
For overflow, it doesn't matter, but by using float8, you have a much
larger range until you underflow to zero. I will make adjustments to
the patch to use this, and add comments explaining its purpose.
--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-12-28 01:42:27 | Re: [BUGS] BUG #2846: inconsistent and confusing |
Previous Message | ITAGAKI Takahiro | 2006-12-28 01:11:52 | Re: Load distributed checkpoint |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-12-28 01:42:27 | Re: [BUGS] BUG #2846: inconsistent and confusing |
Previous Message | ITAGAKI Takahiro | 2006-12-28 01:11:52 | Re: Load distributed checkpoint |