home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
inctime.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-21
|
1KB
|
49 lines
/*********
*
* INCTIME.C
*
* by Ralph Davis
*
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
*********/
/* INCTIME: Time to increase
Computes the time required to increase an investment
by a certain amount
SYNTAX: INCTIME(increase, rate, conversions)
where increase = percentage of increase
rate = annual interest rate
conversions = number of times/year
interest is compounded
RETURNS: number of years required
*/
#include "trlib.h"
TRTYPE inctime()
{
double increase;
double rate;
double conversions;
if (PCOUNT == 3 && ISNUM(1) && ISNUM(2) && ISNUM(3))
{
increase = _parnd(1);
rate = _parnd(2);
conversions = _parnd(3);
if (rate == 0.0 && increase != 0.0)
_retnd(_tr_infinity());
else
_retnd(_tr_log(1.0 + increase) /
(conversions * (_tr_log(1 + rate / conversions))));
}
else
_retnd( (double)ERROR );
}