Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 259 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

NonPeriodic:: (8 methods):
  rate()
  presentValue()
  bothNegAndPos()
  xirrPart1()
  xirrPart2()
  xirrPart3()
  xnpvOrdered()
  validateXnpv()


Class: NonPeriodic  - X-Ref

rate($values, $dates, $guess = self::DEFAULT_GUESS)   X-Ref
XIRR.

Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.

Excel Function:
=XIRR(values,dates,guess)

param: float[] $values     A series of cash flow payments
param: mixed[] $dates      A series of payment dates
param: mixed $guess        An optional guess at the expected answer
return: float|string

presentValue($rate, $values, $dates)   X-Ref
XNPV.

Returns the net present value for a schedule of cash flows that is not necessarily periodic.
To calculate the net present value for a series of cash flows that is periodic, use the NPV function.

Excel Function:
=XNPV(rate,values,dates)

param: float $rate the discount rate to apply to the cash flows
param: float[] $values A series of cash flows that corresponds to a schedule of payments in dates.
param: mixed[] $dates A schedule of payment dates that corresponds to the cash flow payments.
return: float|string

bothNegAndPos(bool $neg, bool $pos)   X-Ref
No description

xirrPart1(&$values, &$dates)   X-Ref

param: mixed $values
param: mixed $dates

xirrPart2(array &$values)   X-Ref
No description

xirrPart3(array $values, array $dates, float $x1, float $x2)   X-Ref

return: float|string

xnpvOrdered($rate, $values, $dates, bool $ordered = true)   X-Ref

param: mixed $rate
param: mixed $values
param: mixed $dates
return: float|string

validateXnpv($rate, array $values, array $dates)   X-Ref

param: mixed $rate