Chapter 9: Special Functions

Usage Notes

Users can perform financial computations by using pre-defined data types. Most of the financial functions require one or more of the following:

      Date

      Number of payments per year

      A variable to indicate when payments are due

      Day count basis

IMSL C/Math/Library provides the identifiers for the input, frequency, to indicate the number of  payments for each year. The identifiers are IMSL_ANNUAL, IMSL_SEMIANNUAL, and IMSL_QUARTERLY.

Identifier (frequency)

Meaning

IMSL_ANNUAL

One payment per year
(Annual payment)

IMSL_SEMIANNUAL

Two payments per year
 (Semi-annual payment)     

IMSL_QUARTERLY

Four payments per year
(Quarterly payment)

IMSL C/Math/Library provides the identifiers for the input, when, to indicate when payments are due. The identifiers are IMSL_AT_END_OF_PERIOD, IMSL_AT_BEGINNING_OF_PERIOD.

 

Identifier (when)

Meaning

IMSL_AT_END_OF_PERIOD

Payments are due at the end of the period

IMSL_AT_BEGINNING_OF_PERIOD

Payments are due at the beginning of the period        

IMSL C/Math/Library provides the identifiers for the input, basis, to indicate the type of day count basis. Day count basis is the method for computing the number of days between two dates. The identifiers are IMSL_DAY_CNT_BASIS_NASD, IMSL_DAY_CNT_BASIS_ACTUALACTUAL, IMSL_DAY_CNT_BASIS_ACTUAL360, IMSL_DAY_CNT_BASIS_ACTUAL365, and IMSL_DAY_CNT_BASIS_30E360.

 

Identifier (basis)

Day count basis

IMSL_DAY_CNT_BASIS_NASD

US (NASD) 30/360

IMSL_DAY_CNT_BASIS_ACTUALACTUAL

Actual/Actual

IMSL_DAY_CNT_BASIS_ACTUAL360

Actual/360

IMSL_DAY_CNT_BASIS_ACTUAL365         

Actual/365

IMSL_DAY_CNT_BASIS_30E360

European 30/360

 

IMSL C/Math/Library uses the C programming language structure, tm, provided in the standard header <time.h>, to represent a date. For a detailed description of tm, see  Kernighan and Richtie 1988, The C Programming Language, Second Edition, p 255.

The structure tm is declared within <time.h> as follows:

struct  tm {
       int     tm_sec;
       int     tm_min;
       int     tm_hour;
       int     tm_mday;
       int     tm_mon;
       int     tm_year;
       int     tm_wday;
       int     tm_yday;
       int     tm_isdst;
};

For example, to declare a variable to represent Jan 1, 2001, use the following code segment:

struct tm date;

 

date.tm_year = 101;

date.tm_mon = 0;

date.tm_mday = 1;

 

NOTE: IMSL C/Math/Library only uses the tm_year, tm_mon, and tm_mday fields
in structure
tm .

Additional Information

In preparing the finance and bond functions we incorporated standards used by
SIA Standard Securities Calculation Methods.

More detailed information on finance and bond functionality can be found in the following manuals:

      SIA Standard Securities Calculation Methods 1993, vols. 1 & 2, Third Edition.

      Accountants' Handbook, Volume 1, Sixth Edition.

      Microsoft Excel 5, Worksheet Function Reference.


Visual Numerics, Inc.
Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260