xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Periods()

Calculates the duration for paying back a loan at fixed interest rate and payments.

Syntax

Periods( <nLoan>       , ;
         <nPayBack>    , ;
         <nInterestRate> ) --> nDuration

Arguments

<nLoan>
A numeric value defining the amount of borrowed capital.
<nPayBack>
A numeric value defining the constant, payback amount.
<nInterestRate>
This parameter defines a constant interest rate per period during the periods of paying back a loan in the range of 0 to 1 (1 equals 100% interest rate).

Return

The function returns a numeric value. It is the number or periods (the duration) a loan must be payed back at fixed payments and fixed interest rate.

Info

See also:Fv(), Payment(), Pv(), Rate()
Category: CT:Math , Financial functions , Mathematical functions
Source:ct\finan.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example calculates the duration of a payback period for
// a loan in months. Monthly payment to pay back a loan of 10000
// units of money is set at 200 units of money. Interest rate is
// 8% per year.

   PROCEDURE Main
      LOCAL nLoan     := 10000      // borrowed capital
      LOCAL nPayback  := 200        // payback units of money per month
      LOCAL nInterest := 0.08/12    // monthly interest rate

      ? Periods( nLoan, nPayback, nInterest )  // result: 61.02 (months)

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe