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'