pub fn syd<T: FloatLike>(
cost: T,
salvage: T,
life: u32,
round: Option<(u32, RoundingMode, T)>,
) -> Vec<DepreciationPeriod<T>>
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.
§Feature
This function requires the std
feature to be enabled as it uses the std::Vec
. syd_into
can be used in a no_std
environment as any allocation is done by the caller.
§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, RoundingMode)
, default is no rounding of calculations. The final depreciation expense is adjusted to ensure the remaining book value is equal to the salvage value.
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;
let cost = 10_000.0;
let salvage = 1_000.0;
let life = 5;
let schedule = syd(cost, salvage, life, None);