Re: Select (str)::FLOAT8 BUG

Поиск
Список
Период
Сортировка
От Tarhon-Onu Victor
Тема Re: Select (str)::FLOAT8 BUG
Дата
Msg-id Pine.LNX.4.58.0406040824130.27156@blackblue.iasi.rdsnet.ro
обсуждение исходный текст
Ответ на Select (str)::FLOAT8 BUG  ("Rafael Villalobos Prats" <rvillalobos@asapci.es>)
Список pgsql-bugs
On Wed, 18 Feb 2004, Rafael Villalobos Prats wrote:

> I think i have found a bug.
>
> I´ve tried it in PgSQL 7.3.5 & 7.4.1
>
> When I do:
>
> atisae_oct_1=# SELECT (1000/500/7)::FLOAT8 as v_numero;
>  v_numero
> ----------
>         0
> (1 row)

    This is not a bug and it also has nothing to do with postgresql.
Try the same in C and you will have the same result.
    The expression 1000/500/7 contains operations between variables
of an integer type: 1000/500 = 2, 2/7=0. 0::float=0.
    Probably a more accurate result will be obtained if you modify
this to:
    1000::float/500/7.
    In this case 1000/500/7::float or 1000::float/500/7 will return
the same result, but 1000::float/501/7 and 1000/501/7::float will not
because the first operation will be between variables of an integer
type.

--
Tarhon-Onu Victor
Area Technical Coordinator
RDS Iasi - Network Operations Center
www.rdsnet.ro, www.rdstel.ro, www.rdslink.ro
Phone: +40-232-218385; Fax: +40-232-260099
..........................................................................
Privileged/Confidential Information may be contained in this message. If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such a case, you should destroy this message and
kindly notify the sender by reply e-mail.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Rob Fielding
Дата:
Сообщение: plpython bug in 7.3.x
Следующее
От: Pavel Stehule
Дата:
Сообщение: is array bug? (array[][])[] = NULL