Indexing
The function uses 1-based cash-flow years, not 0-based array indices.
Return shape
When year_to is omitted or equal to year, the function returns one value. Otherwise, it returns a spilled vector.
Beyond input length
For a single year, if year is greater than the vector length, the function returns 0. For a range, missing tail years are returned as zeros.
Validation
Returns a numeric error when year or year_to is outside 1..120, non-integer, or when year_to < year. Returns a value error if cf cannot be parsed as a non-empty cash-flow vector.