You are here

public static function PHPExcel_Calculation_Financial::EFFECT in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php \PHPExcel_Calculation_Financial::EFFECT()

* EFFECT * * Returns the effective interest rate given the nominal rate and the number of * compounding payments per year. * * Excel Function: * EFFECT(nominal_rate,npery) * * @access public * @category Financial Functions *

Parameters

float $nominal_rate Nominal interest rate: * @param integer $npery Number of compounding payments per year * @return float

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php, line 1150

Class

PHPExcel_Calculation_Financial
PHPExcel_Calculation_Financial

Code

public static function EFFECT($nominal_rate = 0, $npery = 0) {
  $nominal_rate = PHPExcel_Calculation_Functions::flattenSingleValue($nominal_rate);
  $npery = (int) PHPExcel_Calculation_Functions::flattenSingleValue($npery);

  // Validate parameters
  if ($nominal_rate <= 0 || $npery < 1) {
    return PHPExcel_Calculation_Functions::NaN();
  }
  return pow(1 + $nominal_rate / $npery, $npery) - 1;
}