pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ulf Mehlig <umehlig@uni-bremen.de>
To: molivier@yahoo.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] abs value, power, sqrt
Date: Fri, 20 Nov 1998 08:00:01 +0100
Message-ID: <199811200700.IAA01780@uni-bremen.de> (raw)
In-Reply-To: <19981120055303.6281.rocketmail@send105.yahoomail.com>
References: <19981120055303.6281.rocketmail@send105.yahoomail.com>

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
  ~~~~~~~~~~~~~~~~~~~~



view thread (3+ messages)  latest in thread

Message-ID: <199811200700.IAA01780@uni-bremen.de>
Permalink:  ../199811200700.IAA01780@uni-bremen.de/
Also on:    postgresql.org/message-id/199811200700.IAA01780@uni-bremen.de

 · 

reply

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: umehlig@uni-bremen.de, molivier@yahoo.com
  Subject: Re: [SQL] abs value, power, sqrt
  In-Reply-To: <199811200700.IAA01780@uni-bremen.de>
  References: <19981120055303.6281.rocketmail@send105.yahoomail.com> <199811200700.IAA01780@uni-bremen.de>

* 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