Received: from bologna.nettuno.it (bologna.nettuno.it [193.43.2.1]) by hub.org (8.9.1/8.9.1) with ESMTP id KAA03694 for ; Mon, 23 Nov 1998 10:52:17 -0500 (EST) (envelope-from sferac@bo.nettuno.it) Received: from proxy.sferacarta.com (mail@sfcabop1.nettuno.it [193.207.10.213]) by bologna.nettuno.it (8.8.6/8.8.6/NETTuno 3.1) with ESMTP id QAA12763; Mon, 23 Nov 1998 16:50:13 +0100 (MET) Received: from blu.sferacarta.com (mail.sferacarta.com) [10.20.30.12] by proxy.sferacarta.com with smtp (Exim 2.05 #1 (Debian)) id 0zhyR4-0005qC-00; Mon, 23 Nov 1998 16:01:58 +0000 Date: Mon, 23 Nov 1998 15:11:29 +0100 From: Sferacarta Software X-Mailer: The Bat! (v1.017) UNREG Reply-To: Sferacarta Software Organization: Sferacarta Software Priority: Normal Message-ID: <6632.981123@bo.nettuno.it> To: Michael Olivier , Bob Smither , pgsql-sql@postgresql.org Subject: Re[2]: [SQL] abs value, power, sqrt References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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'