Expression Divide By 0

I am using the try() function to capture a divide by 0, but it is not working. Is the try() function not the right method to capture a divide by 0 error?

Only way i can handle a divide by 0 is to add a very small value to the denominator

Floating point divide by zero results in infinity, so if you looked at the diagnostics for that tag it’d probably be some kind of config error due to coercion failing or a tag eval error because Infinity and NaN aren’t valid values in a tag.

OK, so try() only looks for a NULL ?

Why not just check to see if it’s zero?

if({[.]../Count/Count_0_} != 0,
{[.]../Temperatures/Temperatures_0_} / {[.]../Count/Count_0_},

try() wraps the expression evaluation in a try/catch and if an exception is caught uses the bailout value. Divide by None will throw an exception, divide by 0 is infinity, no exception thrown.

Seems reasonable to me!

I have a 250 symbols long expression, part of which can turn to 0 which results the tag status to become “Evaluation error”.

Is there a better way to catch division by 0 error than writing a 250 symbols long check for zero and then rewrite it every time when the main expression needs to be changed?

Bind the part of the expression that can be zero to its own tag/property, then use that in the rest of the expression with the if statement.