Re: Anti log in PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: aspire420(at)hotpop(dot)com
Cc: Wei Weng <wweng(at)kencast(dot)com>, Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Anti log in PostgreSQL
Date: 2003-12-26 23:37:40
Message-ID: 8203.1072481860@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Sai Hertz And Control Systems <sank89(at)sancharnet(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Chris Travers 2003-12-27 02:14:40 Re: Anti log in PostgreSQL
Previous Message Tom Lane 2003-12-26 23:29:06 Re: Database taking up space rapidly

Browse pgsql-sql by date

  From Date Subject
Next Message Andy Lewis 2003-12-26 23:42:08 Radius of a zip code
Previous Message Sai Hertz And Control Systems 2003-12-26 23:25:11 Re: Anti log in PostgreSQL