11.5.4.8. total_depr

total_depr(cost: float, salvage: float, life: float, period: float, factor: float, straight_line: bool) float[source]

Cumulative (total) depreciation up to ‘period’ (can be fractional), using double-declining (or general ‘factor’) balance with optional straight-line switchover when SLN gives a higher amount.

Mirrors the provided JS logic:
  • period can be fractional (e.g., 3.4); only first and last partials are prorated.

  • When straight_line is True, switch from DDB to SLN when SLN > DDB on that step.

  • Caps total depreciation so book value doesn’t go below salvage.