From: Sferacarta Software <sferac@bo.nettuno.it>
To: Michael Olivier <molivier@yahoo.com>
To: Bob Smither <smither@c-c-i.com>
To: pgsql-sql@postgresql.org
Subject: Re[2]: [SQL] abs value, power, sqrt
Date: Mon, 23 Nov 1998 15:11:29 +0100
Message-ID: <6632.981123@bo.nettuno.it> (raw)
References: <Pine.LNX.3.96.981120181104.23513A-200000@cci.c-c-i.com>
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'
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: sferac@bo.nettuno.it, molivier@yahoo.com, smither@c-c-i.com
Subject: Re: [SQL] abs value, power, sqrt
In-Reply-To: <6632.981123@bo.nettuno.it>
References: <Pine.LNX.3.96.981120181104.23513A-200000@cci.c-c-i.com> <6632.981123@bo.nettuno.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox