Re: Anti log in PostgreSQL - Mailing list pgsql-sql

From Tom Lane
Subject Re: Anti log in PostgreSQL
Date
Msg-id 8203.1072481860@sss.pgh.pa.us
Whole thread Raw
In response to Re: Anti log in PostgreSQL  (Sai Hertz And Control Systems <sank89@sancharnet.in>)
Responses Re: Anti log in PostgreSQL
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Yasir Malik
Date:
Subject: Re: Anti log in PostgreSQL
Next
From: "Andy Lewis"
Date:
Subject: Radius of a zip code