Function rust_finprim::amort_dep_tax::syd
source · pub fn syd(
cost: Decimal,
salvage: Decimal,
life: u32,
round: Option<(u32, RoundingStrategy)>
) -> Vec<DepreciationPeriod>
Expand description
Sum of the Years Digits - SYD
Calculates the depreciation schedule for an asset using the sum of the years’ digits method. The sum of the years’ digits method is an accelerated depreciation method that allocates more depreciation expense to the early years of an asset’s life.
§Arguments
cost
- The initial cost of the assetsalvage
- The estimated salvage value of the asset at the end of its useful lifelife
- The number of periods over which the asset will be depreciatedround
(optional) - A tuple specifying the number of decimal places and a rounding strategy for the amounts(dp, RoundingStrategy)
, default is no rounding of calculations. The final depreciation expense is adjusted to ensure the remaining book value is equal to the salvage value.rust_decimal::RoundingStrategy::MidpointNearestEven
(“Bankers Rounding”) is likely what you are looking for as the rounding strategy.
If rounding is enabled, the final period will be adjusted to “zero” out the remaining book value to the salvage value.
§Returns
- A vector of
DepreciationPeriod
instances representing each period in the depreciation schedule.
§Examples
- $10,000 asset, $1,000 salvage value, 5 year life
use rust_finprim::amort_dep_tax::syd;
use rust_decimal_macros::*;
let cost = dec!(10_000);
let salvage = dec!(1_000);
let life = 5;
let schedule = syd(cost, salvage, life, None);