irr(): number
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.
Simple IRR with regular cash flows
Simple IRR with regular cash flows
import { assertAlmostEquals } from "jsr:@std/assert"; assertAlmostEquals(irr([250000, 25000, -10000, -285000]), 0.024712564600136055, 1e-11);
Simple IRR with time periods
Simple IRR with time periods
import { assertAlmostEquals } from "jsr:@std/assert"; assertAlmostEquals(irr([74.2, 37.1, -104.4], [0, 1, 2], 2), -0.07410825700371723, 1e-11);