When to return NaN vs throw an Error?

As a side note, this code will throw an error on Julia 1.3 or earlier if v does not contain any positive numbers. See this thread: