CNLMath : Special Functions : cumulative_interest
cumulative_interest
Evaluates the cumulative interest paid between two periods.
Synopsis
#include <imsl.h>
float imsl_f_cumulative_interest (float rate, int n_periods, float present_value, int start, int end, int when)
The type double function is imsl_d_cumulative_interest.
Required Arguments
float rate (Input)
Interest rate.
int n_periods (Input)
Total number of payment periods. n_periods cannot be less than or equal to 0.
float present_value (Input)
The current value of a stream of future payments, after discounting the payments using some interest rate.
int start (Input)
Starting period in the calculation. start cannot be less than 1; or greater than end.
int end (Input)
Ending period in the calculation.
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 cumulative interest paid between the first period and the last period. If no result can be computed, NaN is returned.
Description
Function imsl_f_cumulative_interest evaluates the cumulative interest paid between the first period and the last period.
It is computed using the following:
where interesti is computed from imsl_f_interest_payment for the i-th period.
Example
In this example, imsl_f_cumulative_interest computes the total interest paid for the first year of a 30-year $200,000 loan with an annual interest rate of 7.25%. The payment is made at the end of each month.
 
#include <stdio.h>
#include <imsl.h>
 
int main()
{
float rate = 0.0725 / 12;
int n_periods = 12 * 30;
float present_value = 200000;
int start = 1;
int end = 12;
float total;
 
total = imsl_f_cumulative_interest (rate, n_periods, present_value,
start, end, IMSL_AT_END_OF_PERIOD);
 
printf ("First year interest = $%.2f.\n", total);
}
Output
 
First year interest = $-14436.52.