yikes, i remember that thread ;P
what i've since discovered is that, while it isn't easy to detect a division by 0 in the midst of any arbitrary expression, we can still perform exception handling to some extent:
var %expression = 1/(1-1)
if (!$calc(0 * (%expression) + 1)) { echo -a error in %expression }
this works since $calc() immediately returns 0 as soon as it encounters a problem. this problem is not limited to division by 0 though, it also occurs when the expression is syntactically invalid (eg. %expression = 1+a, but not %expression = 1+$a) or, rather unfortunately, when the result of a power operation is too large (eg. %expression = 9^999).
i say 'to some extent' since the above method both fails to detect certain invalid expressions (when '$' is used, such as in '1+$a', but we can still easily check that ($ !isin %expression) on top of it) and, more worryingly, falsely detects valid expressions (9^999 is a valid expression but fails due to its size).