47            if (($f1 * $f2) < 0.0) {
 
   50            if (abs($f1) < abs($f2)) {
 
   56        if (($f1 * $f2) > 0.0) {
 
   76            if ((abs($f_mid) < self::FINANCIAL_PRECISION) || (abs($dx) < self::FINANCIAL_PRECISION)) {
 
  111        $rr = 1.0 + $reinvestmentRate;
 
  112        $fr = 1.0 + $financeRate;
 
  114        $npvPos = $npvNeg = 0.0;
 
  117                $npvPos += $v / $rr ** 
$i;
 
  119                $npvNeg += $v / $fr ** 
$i;
 
  123        if (($npvNeg === 0.0) || ($npvPos === 0.0) || ($reinvestmentRate <= -1.0)) {
 
  127        $mirr = ((-$npvPos * $rr ** 
$n)
 
  128                / ($npvNeg * ($rr))) ** (1.0 / (
$n - 1)) - 1.0;
 
  150        $countArgs = count($aArgs);
 
  151        for (
$i = 1; 
$i <= $countArgs; ++
$i) {
 
  153            if (is_numeric($aArgs[
$i - 1])) {
 
  154                $returnValue += $aArgs[
$i - 1] / (1 + $rate) ** 
$i;
 
An exception for terminatinating execution or to throw for unit testing.
const FINANCIAL_MAX_ITERATIONS
const FINANCIAL_PRECISION
static rate($values, $guess=0.1)
IRR.
static modifiedRate($values, $financeRate, $reinvestmentRate)
MIRR.
static presentValue($rate,... $args)
NPV.
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.