Re: [SQL] abs value, power, sqrt

From: Ulf Mehlig <umehlig(at)uni-bremen(dot)de>
To: molivier(at)yahoo(dot)com
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] abs value, power, sqrt
Date: 1998-11-20 07:00:01
Message-ID: 199811200700.IAA01780@uni-bremen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael Olivier <molivier(at)yahoo(dot)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(at)zmt(dot)uni-bremen(dot)de>
%%%%!%%% Projekt "MADAM" <umehlig(at)uni-bremen(dot)de>
%%%% %!% %%%% ----------------------------------------------------
---| %%% MADAM: MAngrove | Center for Tropical Marine
||--%!% Dynamics | Biology
|| And | Fahrenheitstrasse 1
_ /||\_/\_ Management |
/ / \ \ ~~~~~~~~~~~~~~~~~ | 28359 Bremen/Germany
~~~~~~~~~~~~~~~~~~~~

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver Elphick 1998-11-20 07:28:58 Re: [SQL] Postgres installed but my C programs won't compile
Previous Message Michael Olivier 1998-11-20 05:53:03 abs value, power, sqrt