Tom Lane wrote:
> Roman Kononov <[EMAIL PROTECTED]> 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.
! * it is difficult to tell if a value is really infinity or the
! * 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
+ * slighly smaller than FLOAT8_MIN, the result is non-zero, but if
+ * much smaller than FLOAT8_MIN, the value becomes zero. However,
+ * unlike overflow, zero is not a special value and can be the
+ * 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
+ * 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 [EMAIL PROTECTED]
+ If your life is a hard drive, Christ can be your backup. +
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings