The function also passes over the data twice, and is significantly slower than single loop with
positive += ifelse(x>0, x, zero(x))
negaitive -= ifelse(x<0, x, zero(x))
On the overall question, the more I think about it, the more it seems right to return 0, Inf, NaN, and let the caller sort it out. Each of those are perfectly valid results of a division, and might be of interest to the caller. There is nothing intrinsically wrong about those results, seen from inside a function that simply calculates ratios, and there may or may not be, seen from the outside.