Re: How to increase precision?

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: How to increase precision?
Дата
Msg-id 20030502221331.86C2B103C9@polaris.pinpointresearch.com
обсуждение исходный текст
Ответ на How to increase precision?  ("Katka a Daniel Dunajsky" <daniel_katka@hotmail.com>)
Список pgsql-sql
It's assuming INTs and doing int division. Make one a numeric/real or
explicitly cast:

steve=# select 5/2;?column?
----------       2
(1 row)

steve=# select 5./2;?column?
----------     2.5
(1 row)

Cheers,
Steve



On Friday 02 May 2003 2:38 pm, Katka a Daniel Dunajsky wrote:
> Hello all,
>
> this is a newbie question:
>
> How to increase the precision of calculations in posgresql?
>
> When I run this query:
>
> select 5/2;
>
> I get:
>
> ?column?
> --------
>        2
>
> It should be 2.5 shouldn't it?
>
> Thank you for your time.
>
> Daniel
>
>
>
>
>
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster



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

Предыдущее
От: Kyle
Дата:
Сообщение: Best way to delete time stamped data?
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: How to increase precision?