I have a function that expects a positive number as argument, for example:
f(x) = sqrt(x)
I want to be safe about this, so I want to throw an error if x < 0. Currently I do an assert:
function f(x)
@assert x >= 0
sqrt(x)
end
Is this the recommended way? Or should I throw an error instead? Are there guidelines for this?