pub fn macrs(cost: Decimal, rates: &[Decimal]) -> Vec<DepreciationPeriod>
Expand description
MACRS Deprectiation
Calculates the depreciation schedule for an asset using the Modified Accelerated Cost Recovery System (MACRS method). MACRS is a depreciation method allowed by the IRS for tax purposes.
§Arguments
cost
- The initial cost of the assetrates
- A slice representing the MACRS depreciation rates for all periods of the asset’s life, starting with the first year (period 1) and ending with the last year (period 2). Rates for each period can be found in IRS Publication 946 or other tax resources. The rates should be in decimal form (e.g., 0.20 for 20%).
§Returns
- A vector of
DepreciationPeriod
instances representing each period in the depreciation schedule. The length of the vector will be equal to the number of rates provided.
§Examples
- $10,000 asset, MACRS rates for 5 year life
use rust_finprim::amort_dep_tax::macrs;
use rust_decimal_macros::*;
use rust_decimal::Decimal;
let cost = dec!(10_000);
let rates = vec![
dec!(0.20),
dec!(0.32),
dec!(0.1920),
dec!(0.1152),
dec!(0.1152),
dec!(0.0576)
];
let schedule = macrs(cost, &rates);