From: | Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it> |
---|---|
To: | Michael Olivier <molivier(at)yahoo(dot)com>, Bob Smither <smither(at)c-c-i(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re[2]: [SQL] abs value, power, sqrt |
Date: | 1998-11-23 14:11:29 |
Message-ID: | 6632.981123@bo.nettuno.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello Bob,
sabato, 21 novembre 98, you wrote:
BS> On Thu, 19 Nov 1998, Michael Olivier wrote:
BS> :Hi folks,
BS> :
BS> :I previously posted this to pgsql-novice but haven't gotten an answer,
BS> :so I thought I'd try here.
BS> :
BS> :I need a way to get abs value of a floating point number and (possibly
BS> :separate function for) abs value of an integer in a select statement.
BS> :Is there a function to do this? If not, how can I write a function to
BS> :do it?
BS> :
BS> :Also how do I do squares and square roots? I saw some \|/ type notation
BS> :for square root in an SQL book, but I didn't get postgres to take that.
------------------------------------------------------------------------
funct PostgreSQL result remarks
------------------------------------------------------------------------
ABS: select @ -12 12 absolute value
MODULE: select 100 % 3 1 module
POWER: select dpow(12,2) 144 power
ROUND: select dround(12.7) 13 round
SQRT: select dsqrt(144) 12 square root
TRUNC: select dtrunc(1.2) 1 truncate int value
ROOT3: select dcbrt(27) 3 cube root
LOG: select dlog1(100) 4.60517018598809 logarithm
EXP: select dexp(2) 7.38905609893065 exponent
------------------------------------------------------------------------
Jose'
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1998-11-23 16:10:59 | Re: [SQL] optimizing 2-table join w/millions of rows |
Previous Message | Herouth Maoz | 1998-11-23 13:09:09 | Re: [SQL] optimizing 2-table join w/millions of rows |