pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: aspire420@hotpop.com
Cc: Wei Weng <wweng@kencast.com>
Cc: Martin Marques <martin@bugs.unl.edu.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: Anti log in PostgreSQL
Date: Fri, 26 Dec 2003 18:37:40 -0500
Message-ID: <8203.1072481860@sss.pgh.pa.us> (raw)
In-Reply-To: <3FECC357.6040206@sancharnet.in>
References: <3FECB238.1050801@sancharnet.in>
	<200312261934.35070.martin@bugs.unl.edu.ar>
	<3FECBA50.2000500@sancharnet.in>
	<3FECBBEA.5080100@kencast.com>
	<3FECC357.6040206@sancharnet.in>

Sai Hertz And Control Systems <sank89@sancharnet.in> writes:
>> What is the mathematical operation that "antilog" is supposed to perform?

> Its going to calculate rate of intrest  for an fixed deposit ,

This is not a mathematical operation, it is a financial issue
that has to conform to rules developed long ago by bankers.
The closest thing that PG offers is 10^x, but

regression=# select 10^(3.3234);
     ?column?
------------------
 2105.71698391175
(1 row)

which is not real close to the 2144 that you say you want.  The
difference must be due to compounding rules, and perhaps also
accumulated roundoff in the monetary amounts.  I think you will
need to write a little function (in plpgsql or your language of
choice) that performs the sequence of compounding steps, if you
want to get an answer that a banker will like.

			regards, tom lane



view thread (12+ messages)  latest in thread

Message-ID: <8203.1072481860@sss.pgh.pa.us>
Permalink:  ../8203.1072481860@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8203.1072481860@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, aspire420@hotpop.com, wweng@kencast.com, martin@bugs.unl.edu.ar
  Subject: Re: Anti log in PostgreSQL
  In-Reply-To: <8203.1072481860@sss.pgh.pa.us>

* 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