Currently, I'm not aware of a built-in way.  Part of the problem is that comparing two numbers for equality is not trivial.

The `eval` function has a `==` operator in the math parser that does this properly (with a floating-point epsilon), and https://cfengine.com/dev/issues/3388 has my proposal to use that math parser throughout the core.  So if https://cfengine.com/dev/issues/3388 is accepted we would have the means to do this easily.  Otherwise we have to use the method above.