Skip site navigation (1) Skip section navigation (2)

cast int to float

From: "sheila timp" <shilet(at)hotmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: cast int to float
Date: 2001-12-29 22:26:12
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

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 

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


pgsql-novice by date

Next:From: sheila timpDate: 2001-12-29 23:19:27
Subject: cast int to float
Previous:From: Frank BaxDate: 2001-12-23 03:19:37
Subject: Re: Three table query

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group