import type { array } from "../types"; /** * Internal rate of return on an investment based on a series of periodic cash flows. * * Calculates the internal rate of return on an investment * based on a series of regularly/irregularly periodic cash flows. * * @param cf Cash flows associated with the investment. Must contain at least one negative and one positive cash flow * @param cfd Number of calendar days from the beginning of the period that cash flow occurs (defaults to sequential periods) * @param cd Total number of calendar days in the measurement period (defaults to 1) * @param guess Initial estimate for what the internal rate of return will be (defaults to 0.1) * @returns A real rate above -1 near the supplied guess; non-conventional flows may have multiple roots * @throws If insufficient arguments or convergence fails * * @example Simple IRR with regular cash flows * ```ts * import { assertAlmostEquals } from "jsr:@std/assert"; * * assertAlmostEquals(irr([250000, 25000, -10000, -285000]), 0.024712564600136055, 1e-11); * * ``` * * @example Simple IRR with time periods * ```ts * import { assertAlmostEquals } from "jsr:@std/assert"; * * assertAlmostEquals(irr([74.2, 37.1, -104.4], [0, 1, 2], 2), -0.07410825700371723, 1e-11); * * ``` * * @example Modified IRR with irregular time periods * ```ts * import { assertAlmostEquals } from "jsr:@std/assert"; * * assertAlmostEquals(irr([250000, 25000, -10000, -285000], [0, 45, 69, 90], 90), 0.07692279592283387, 1e-11); * * ``` * * @example Modified IRR with different calendar days * ```ts * import { assertAlmostEquals } from "jsr:@std/assert"; * * assertAlmostEquals(irr([74.2, 37.1, -104.4], [0, 14, 31], 31), -0.07271460953489632, 1e-11); * ``` */ export default function irr(cf: array, cfd?: array, cd?: number, guess?: number): number; //# sourceMappingURL=irr.d.ts.map