CNLMath : Special Functions : number_of_periods
number_of_periods
Evaluates the number of periods for an investment for which periodic and constant payments are made and the interest rate is constant.
Synopsis
#include <imsl.h>
float imsl_f_number_of_periods (float rate, float payment, float present_value, float future_value, int when)
The type double function is imsl_d_number_of_periods.
Required Arguments
float rate (Input)
Interest rate on the investment.
float payment (Input)
Payment made on the investment.
float present_value (Input)
The current value of a stream of future payments, after discounting the payments using some interest rate.
float future_value (Input)
The value, at some time in the future, of a current amount and a stream of payments.
int when (Input)
Time in each period when the payment is made, either IMSL_AT_END_OF_PERIOD or IMSL_AT_BEGINNING_OF_PERIOD. For a more detailed discussion on when see the Usage Notes section of this chapter.
Return Value
The number of periods for an investment.
Description
Function imsl_f_number_of_periods computes the number of periods for an investment based on periodic, constant payment and a constant interest rate.
It can be found by solving the following:
If rate =0
If rate 0
Example
In this example, imsl_f_number_of_periods computes the number of periods needed to pay off a $20,000 loan with a monthly payment of $350 and an annual interest rate of 7.25%. The payment is made at the beginning of each period.
 
#include <stdio.h>
#include <imsl.h>
 
int main()
{
float rate = 0.0725 / 12;
float payment = -350.;
float present_value = 20000;
float future_value = 0.;
int when = IMSL_AT_BEGINNING_OF_PERIOD;
float number_of_periods;
 
number_of_periods = imsl_f_number_of_periods (rate, payment,
present_value, future_value, when);
 
printf ("Number of payment periods = %f.\n", number_of_periods);
}
Output
 
Number of payment periods = 70.