Division by zero runs without warning -> complicates finding bugs

But when you do have a problem, you go back and look for it, at which point performance is not so important. Fortunately, with Julia you can usually plug in a different type that acts just like Float64 or whatever, except that it checks for bad conditions. @brianguenter suggested a NaNCheck type here, which I’ve used to track down NaNs in my code.(*) I keep meaning to put that together as a little package, because there have been a few times when this issue has crept up.

Along the same lines is SaferIntegers.jl, which may be more specifically relevant to the OP.


(*) I’ve also found it useful to initialize arrays with NaNCheck{Float64}(NaN), so that I can find when I used uninitialized data.

4 Likes