Re: How to increase precision? - Mailing list pgsql-sql

From Steve Crawford
Subject Re: How to increase precision?
Date
Msg-id 20030502221331.86C2B103C9@polaris.pinpointresearch.com
Whole thread Raw
In response to How to increase precision?  ("Katka a Daniel Dunajsky" <daniel_katka@hotmail.com>)
List 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 by date:

Previous
From: Kyle
Date:
Subject: Best way to delete time stamped data?
Next
From: Josh Berkus
Date:
Subject: Re: How to increase precision?