Integer to float function

Started by Steven Vajdicabout 25 years ago5 messageshackers
Jump to latest
#1Steven Vajdic
svajdic@asc.corp.mot.com

Einar Karttunen wrote:

integer (float_expression) or int (float_expression) DO work on

RedHat6.2/PostgreSQL6.5 and DO NOT work on Mandrake/PostgreSQL7.0.2

Try using int2()/int4()/int8() instead of integer(). The intn()

functions

convert the float to a integer n bytes long, in normal cases you

probably

want to use int4().

Einar,

Much obliged.

int4() has done a job.

Why is that NOT documented under "Matematical functions"?

Regards,

Steven.

--
***********************************************

Steven Vajdic (BSc/Hon, MSc)
Senior Software Engineer
Motorola Australia Software Centre (MASC)
2 Second Avenue, Technology Park
Adelaide, South Australia 5095
email: Steven.Vajdic@motorola.com
email: svajdic@asc.corp.mot.com
Ph.: +61-8-8168-3435
Fax: +61-8-8168-3501
Front Office (Ph): +61-8-8168-3500

----------------------------------------
mobile: +61 (0)419 860 903
AFTER WORK email: steven_vajdic@ivillage.com
----------------------------------------

***********************************************

#2Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Steven Vajdic (#1)
Re: Integer to float function

integer (float_expression) or int (float_expression) DO work on

RedHat6.2/PostgreSQL6.5 and DO NOT work on Mandrake/PostgreSQL7.0.2
Try using int2()/int4()/int8() instead of integer().

Why is that NOT documented under "Matematical functions"?

Because we haven't received any patches to document it? ;)

- Thomas

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Steven Vajdic (#1)
Re: Integer to float function

Steven Vajdic writes:

int4() has done a job.

Why is that NOT documented under "Matematical functions"?

Because you're supposed to use CAST(value AS integer).

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Thomas Lockhart (#2)
Re: Re: Integer to float function

Thomas Lockhart <lockhart@alumni.caltech.edu> writes:

Try using int2()/int4()/int8() instead of integer().

Why is that NOT documented under "Matematical functions"?

Because we haven't received any patches to document it? ;)

Or because it's not a mathematical function. I don't think that
datatype conversion functions belong under that heading.

regards, tom lane

#5Noname
steven_vajdic@ivillage.com
In reply to: Tom Lane (#4)
Re: Re: Integer to float function

On Fri, 06 April 2001, Tom Lane wrote:

Thomas Lockhart <lockhart@alumni.caltech.edu> writes:

Try using int2()/int4()/int8() instead of integer().

Why is that NOT documented under "Matematical functions"?

Because we haven't received any patches to document it? ;)

Or because it's not a mathematical function. I don't think that
datatype conversion functions belong under that heading.

regards, tom lane

I did not mean to question the position
of integre() or int4(), or ... in the PostgreSQL documents.

I HAVE found a list of functions, among them integer(), under mathematical functions and have NOT found anything about int4() or intn(), should I say. Perhaps, I was not searching the docs enough, but you know how we do things in a hurry - we do search the TOC.

So, if there is intn() desribed somewhere in the docs, I apologise BUT there is not then we have a communication problem.

Thanks in any case. The most important thing is that my migration from RedHat6.2/postgreSQL6.5 to Mandrake/PostgreSQL7.0.2 was easy and successfull, mostly because of this forum and questions/answers that we have
in circulation.

Cheers,

Steven.

_________________________________________________________________
iVillage.com: Solutions for Your Life
Check out the most exciting women's community on the Web
http://www.ivillage.com