From: | Henry Drexler <alonup8tb(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: integer instead of 'double precision'? |
Date: | 2011-09-09 16:12:22 |
Message-ID: | CAAtgU9T1X_EzBYP4XtWNR9KfJCpE1jjG3KXfxb9WcTHJGL9S=w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
thanks Tom and Guillaume,
*That sequencing of casting makes sense - I appreciate the clear
explanation.
*
*
*
On Fri, Sep 9, 2011 at 11:12 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Henry Drexler <alonup8tb(at)gmail(dot)com> writes:
> > [ "1/3" yields zero ]
>
> Yeah, it's an integer division.
>
> > I thought perhaps I could cast it as double precision as noted on
> > http://www.postgresql.org/docs/8.3/interactive/sql-expressions.html
> > though doing the following:
> > float8(1/3)
>
> That's casting the result of the division to float, which is way too
> late. You need to cast one or both inputs to non-integer, for instance
>
> 1.0/3
> 1/(3::float8)
>
> etc etc.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2011-09-09 16:25:40 | Re: PostgreSQL Upgrade Procedure |
Previous Message | Merlin Moncure | 2011-09-09 15:55:00 | Re: hiring PostgresSQL admin |