Integer division

In the Ignition designer I choose for a numeric text field as type Integer, and as Integer value the expression 1 / 2
I would expect the value shown in the text field would be 0 (like it does in C, Java…) but the result shown is rounded up to 1
Why works integer division different, is it some setting ?

I would suggest if you want full control over rounding you do it yourself before the tag gets a chance to cast the value, as it seems the tag system is inconsistent in this regard.

In the expression language everything is a double, so applying the floor expression here will get you the result you’re looking for.

1 Like