Finance › Accounting ›
deprec Pro Rated
Return the depreciation for each accounting period.
Excel: AMORLINC
Controller: CodeCogs
Dependents
Interface
C++
DeprecProRated
doubledeprecProRated( | double | valCost | |
int | datePu | ||
int | dateFi | ||
double | valSalv | ||
int | period | ||
double | rate | ||
Finance::Banking::YearBasis | basis | ) |
Example 1
#include <stdio.h> #include <codecogs/units/date/date.h> #include <codecogs/finance/accounting/deprecprorated.h> int main(void) { int datePur=Units::Date::date(1998, 8, 19); int dateFir=Units::Date::date(1998, 12, 31); double deprec; deprec=Finance::Accounting::deprecProRated(2400, datePur, dateFir, 300, 1, 0.15, Finance::Banking::yb_Act); int y, m, d; printf("Consider an asset with the following terms:\n\n"); printf("cost 2400, salvage 300, 1st period, rate 15%%\n"); Units::Date::dateYMD(datePur, y, m, d); printf("purchase date %i/%i/%i, ", y, m, d); Units::Date::dateYMD(dateFir, y, m, d); printf("end of first period %i/%i/%i, ", y, m, d); printf("depreciation=%f\n", deprec); return 0; }
OutputConsider an asset with the following terms: cost 2400, salvage 300, 1st period, rate 15% purchase date 1998/8/19, end of first period 1998/12/31, depreciation=360.0
0.15).
Type | Value | Description |
yb_US | 0 | US (NASD) 30/360 - As with the European 30/360 (yb_EU, with the additional provision that if the end date occurs on the 31st of a month it is moved to the 1st of the next month if the start date is earlier than the 30th. |
yb_Act | 1 | Uses the exact number of elapsed days between the two dates, as well as the exact length of the year. |
yb_Act360 | 2 | Uses the exact number of elapsed days between two dates but assumes the year only have 360 days |
yb_Act365 | 3 | Uses the exact number of elapsed days between two dates but assumes the year always has 365 days |
yb_EU | 4 | European 30/360 - Each month is assumed to have 30 days, such that the year has only 360 days. Start and end dates that occur on the 31st of a month become equal to the 30th of the same month. |
Note
- In Excel, AMORLIC does not allow a YearBasis of yb_Act360. We can see few reasons for this restriction, so it is provided here. Otherwise this function should replicate Excel in every way.
Parameters
valCost The cost of the asset. datePu The date of purchase of the asset. dateFi The date of the end of the first period. valSalv The salvage value at the end of the life of the asset. period The period. rate The rate of depreciation (e.g. 15% depreciation rate is basis The day count basis to use, one of:
Returns
- The depreciation for each accounting period.
Authors
- James Warren (August 2005)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.