Chapter 9: Special Functions > present_value_schedule

present_value_schedule

Evaluates the present value for a schedule of cash flows. It is not necessary that the cash flows be periodic.

Synopsis

#include <imsl.h>

float imsl_f_present_value_schedule (float rate, int count, float values[], struct  tm dates[])

The type double function is imsl_d_present_value_schedule.

Required Arguments

float rate   (Input)
Interest rate.

int count   (Input)
Number of cash flows in values or number of dates in dates.

float values[]   (Input)
Array of size count of cash flows.

struct tm dates[]   (Input)
Array of size count of dates cash flows are made. For a more detailed discussion on dates see the “Usage Notes” section of this chapter.

Return Value

The present value for a schedule of cash flows that is not necessarily periodic.  If no result can be computed, NaN is returned.

Description

Function imsl_f_present_value_schedule computes the present value for a schedule of cash flows that is not necessarily periodic.

It can be found by solving the following:

In the equation above, di represents the i-th payment date, d1 represents the 1st payment date, and valuei represents the i-th cash flow.

Example

In this example, imsl_f_present_value_schedule computes the present value of 3 payments, $1,000, $2,000 and $1,000, with an interest rate of 5% made on January 3, 1997, January 3, 1999 and January 3, 2000.

 

#include <stdio.h>

#include <imsl.h>

 

int main()

{

    float rate = 0.05;

    float values[3] = { 1000.0, 2000.0, 1000.0 };

    struct tm dates[3];

    float xnpv;

 

    dates[0].tm_year = 97; dates[0].tm_mon = 0; dates[0].tm_mday = 3;

    dates[1].tm_year = 99; dates[1].tm_mon = 0; dates[1].tm_mday = 3;

    dates[2].tm_year = 100; dates[2].tm_mon = 0; dates[2].tm_mday = 3;

 

    xnpv = imsl_f_present_value_schedule (rate, 3, values, dates);

    printf ("The present value of the cash flows is $%.2f.\n", xnpv);

}

Output

The present value of the cash flows is $3677.90.


RW_logo.jpg
Contact Support