Re: [SQL] abs value, power, sqrt - Mailing list pgsql-sql

From Ulf Mehlig
Subject Re: [SQL] abs value, power, sqrt
Date
Msg-id 199811200700.IAA01780@uni-bremen.de
Whole thread Raw
In response to abs value, power, sqrt  (Michael Olivier <molivier@yahoo.com>)
List pgsql-sql
Michael Olivier <molivier@yahoo.com> wrote:

> I need a way to get abs value of a floating point number and
> (possibly separate function for) abs value of an integer in a select
> statement.

You had to look up the manuals  at numerical *operators* -- no need to
define YAF ;-)

      => select @-17.0;
   17

> Also how do I do squares and square roots? I saw some \|/ type
> notation for square root in an SQL book, but I didn't get postgres
> to take that.

try e.g.

      => select 2*2, 2^2;
   4        4

and:
      => select |/2;
   1.4142135623731

without the backslash (originally quoting in a shell?) it seems to
work ...

Hope it helps
Ulf

--
======================================================================
 %%%%%            Ulf Mehlig              <umehlig@zmt.uni-bremen.de>
   %%%%!%%%       Projekt "MADAM"         <umehlig@uni-bremen.de>
%%%% %!% %%%%     ----------------------------------------------------
 ---| %%%         MADAM:  MAngrove    |  Center for Tropical Marine
    ||--%!%              Dynamics     |  Biology
    ||                  And           |  Fahrenheitstrasse 1
 _ /||\_/\_            Management     |
/  /    \  \ ~~~~~~~~~~~~~~~~~        |  28359 Bremen/Germany
  ~~~~~~~~~~~~~~~~~~~~

pgsql-sql by date:

Previous
From: Michael Olivier
Date:
Subject: abs value, power, sqrt
Next
From: "Oliver Elphick"
Date:
Subject: Re: [SQL] Postgres installed but my C programs won't compile