Change Syntax "Integer period" to "Number period".
Add Constraints:
cost >= 0, salvage >= 0, salvage <= cost, 1 <= period <= lifeTime, declinationFactor > 0
The formula using integer periods according to http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Calc:_DDB_function would be
To calculate depreciation, DDB uses a fixed rate. When declinationFactor = 2 this is the double-declining-balance method (because it is double the straight-line rate that would depreciate the asset to zero). The rate is given by:
rate = declinationFactor / lifeTime
The depreciation each year is calculated as
depreciation_of_year = MINIMUM( book_value_at_start_of_year * rate; book_value_at_start_of_year - salvagevalue )
Thus the asset depreciates at rate until the book value is salvagevalue.
book_value_at_start_of_year_i = originalcost - sigma_i(1,year_i-1,depreciation_of_year_i)
The current formula is missing the MINIMUM evaluation and uses only (book_value_at_start_of_year * rate), hence the TODO in the draft.
Alternative algorithm allowing for non-integer periods:
rate = declinationFactor / lifeTime
if rate >= 1 then
rate = 1
if period == 1 then
oldValue = cost
else
oldValue = 0
endif
else
oldValue = cost * pow( 1 - rate, period - 1 )
endif
newValue = cost * pow( 1 - rate, period )
if newValue < salvage then
DDB = oldValue - salvage
else
DDB = oldValue - newValue
endif
if DDB < 0 then
DDB = 0
endif