home *** CD-ROM | disk | FTP | other *** search
- /*********
- *
- * EFFYIELD.C
- *
- * by Ralph Davis
- * modified by Tom Rettig
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- *********/
-
- /* EFFYIELD: Effective Yield (Effective Rate of Interest)
-
- Computes effective annual interest for annual rate
- compounded specified number of times per year
-
- SYNTAX: EFFYIELD(rate, conversions)
- where rate = nominal interest rate
- conversions = number of times per year
- interest is compounded
-
- RETURNS: true yield
- */
-
- #include "trlib.h"
-
- TRTYPE effyield()
- {
- if ( PCOUNT==2 && ISNUM(1) && ISNUM(2) )
- {
- double rate = _parnd(1);
- double conversions = _parnd(2);
-
- _retnd(pow(1.0 + (rate / conversions),conversions) - 1.0);
- }
- else
- _retnd( (double)ERROR );
- }
-