@Patrick Zweekhorst found some interesting behavior when variants containing strings are involved in arithmetic. For example, consider the following:
Variant str = "Hello world"; return [1 + str, str + 1, 60 * str, str * 60, str / 10, 10 / str]; // Gives [1, 1, 0, 60, 10, 1.#INF00]
I cannot even figure out what is going on here: sometimes strings behave as the identity (0 for addition, 1 for multiplication) but not always and the operators no longer even seem commutative.
It would have made sense if this threw an exception, or even just gave 0.
Of course, the solution is not to use strings and check the type first before you do. But in this case, where the variant was read from a table (str = Table("GlobalTable")[1][1]
) it took a while to figure out what went wrong in the model, since the resulting numbers (aside from 10 / str) look quite reasonable.