Created
January 27, 2013 18:33
-
-
Save ghalimi/4649641 to your computer and use it in GitHub Desktop.
SLN Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 Sutoiku, Inc. (MIT License) | |
function SLN(cost, salvage, life) { | |
// Return error if any of the parameters is not a number | |
if (isNaN(cost) || isNaN(salvage) || isNaN(life)) return '#VALUE!'; | |
// Return error if life equal to 0 (zero) | |
if (life === 0) return '#NUM!'; | |
// Return straight-line depreciation | |
return (cost - salvage) / life; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment