Class 3 Error
Some CEL expressions that use the exponentiation operator (^) do not appear to be evaluated correctly. For example, the CEL expression
2^((1 [m] + 1 [m]) / 1 [cm])
is evaluated as 4, whereas its correct value is 2^200.
This is due to a bug in the CEL expression evaluator for expressions that use the exponentiation operator (^) and involve mixtures of different but dimensionally consistent units (for example [m] and [cm]).
This error occurs when all of the following are true:
- the exponent is a constant expression.
- ignoring any units, all terms in the expression are integer constants
- ignoring any units, the expression evaluates to an integer (e.g. in the above case the expression (1 + 1)/1 = 2)
- the expression would evaluate to a different value if units were taken into account
For example, the following expressions will evaluate correctly:
2^(3 [m/m]) --> effectively no units in this case
2^((1 + 2) /3) --> no units involved, exponent resolves to 1
2^((1 + 1) /4) --> no units and exponent resolves to non-integer value
2^((1 [m] + 1 [m]) /2[m]) --> same units used throughout
2^((1 [m] + 1 [m]) /4[cm]) --> exponent does not resolve to integer if units ignored
Note that irrespective of this problem, an exponent expression must be internally dimensionally consistent and must resolve to a dimensionless value. An expression that does not satisfy these requirements will generate an error whe
Modify the expression in line with the above recommendations to avoid the error.