Finance namespace

You're viewing an older version of this page (#5548). View the current version.

View versions (2)

Interface

#include <codecogs/finance/banking/interesteffective.h>

using namespace Finance::Banking;

This function computes the effective annual interest rate, based on the nominal interest rate and the number of compounding periods per year.

It is based on the following equation,

$$\left ( 1 + \frac{rate}{npery} \right ) ^ {npery} - 1$$
(1)

where

  • rate is the nominal interest rate, and
  • npery is the number of compounding periods per year,

expressed as an integer.

Example 1

#include <stdio.h>
#include <codecogs/finance/banking/interesteffective.h>
 
int main()
{
  int i;
  float f = 4.25;
   
  printf("      Rate    NPery   Effective\n");
  for (i=3;i<10;++i)
  {
    printf("    %f      %d      %f\n",f,i,Finance::Banking::interestEffective(f,i));
    ++f;
  }
  return 0;
}

Output

Rate          NPery     Effective
 4.250000        3       0.043105
 5.250000        4       0.053542
 6.250000        5       0.064083
 7.250000        6       0.074726
 8.250000        7       0.085475
 9.250000        8       0.096331
 10.250000       9       0.107296

Parameters

rate
is the nominal interest rate, expressed as a percentage (e.g. 4.25 for 4.25%).
Blank

If less than or equal to 0, effect will return -1

Parameters

npery
is the number of compounding periods per year, expressed as an integer.

It is assumed that no withdrawals are made on the sum.

Blank

James Warren (August 2005)

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

rate
npery
Result