cast int to float - Mailing list pgsql-novice

From sheila timp
Subject cast int to float
Date
Msg-id F26tYogMdi2GlQMXi8B0000e9d2@hotmail.com
Whole thread Raw
Responses Re: cast int to float  (Frank Bax <fbax@sympatico.ca>)
List pgsql-novice
Hi,

I'm creating a new database-item by dividing two existing items. When these
items are initially declared as float, there is no problem. On the other
hand, when they are declared as int initially and later converted to float,
I get the error: float8div: divide by zero error. Maybe I didn't do the
casting right. This is what I did:

((cast(item1 as float))/(cast(item2 as float) + cast (item3 as float))) as
item4.

I played around with putting the brackets at different places, but every
time got the same error message.
Hopefully someone knows what I should do,

Thanks Sheila

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


pgsql-novice by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: some questions about PostgreSQL in general
Next
From: Frank Bax
Date:
Subject: Re: dos Dbase -> pg table