"=?iso-8859-2?B?U1rbQ1MgR+Fib3I=?=" <surrano(at)mailbox(dot)hu> writes:
> QUESTION 1: Is it intentional that converting 0.5 to int4
> - from numeric: rounds *away from* zero
> - from float: rounds *towards* zero (tried float4 and float8 too)?
Numeric currently rounds away from zero. We cannot guarantee to make
it work the same as float, because float's rounding behavior is
platform-dependent. A common but not universal behavior is "round to
nearest even integer". See the recent thread about the round() function
(I forget which list it was in, but it was within the past week).
> QUESTION 2: Is it safe to assume it won't change (haven't changed) in the
> upcoming versions?
Numeric's behavior hasn't changed as of 7.4beta5. I do not have a
crystal ball to predict whether we might change it in the future.
I doubt we will ever try to override the platform behavior for float.
regards, tom lane
In response to
pgsql-sql by date
|Next:||From: SZŰCS Gábor||Date: 2003-10-28 16:42:10|
|Subject: Re: numeric and float converts to int differently?|
|Previous:||From: Christoph Haller||Date: 2003-10-28 15:43:12|
|Subject: Re: URGENT!!! changing Column size|