Defining a function would seem like exactly the right thing to do! There's no problem.
Re:1/0 = 0
by nostrademons on Saturday August 11, 2018 @03:57AM
(#17738820)
Module-scoped operator overloading would be really, really nice in this situation, though.
Defining x / 0 = 0 gets this behavior for free, while leaving zero as an exception means it has to be caught for every single signal calculation, which is a pain when there are potentially dozens of different signals, all of which are counting different things (and have different divisors). I've actually defined a helper function to do this automatically, which also lets me change the default "null object" easily if I choose a different representation or want to apply some baseline value.